[ILUG] Booting a broken raid array

Pádraig Brady P at draigBrady.com
Fri Jan 16 11:58:08 GMT 2009


John Allen wrote:
> For installation I typically partition disk 1 (using cfdisk), and do
> sfdisk -d /dev/sda | sfdisk /dev/sdX
> 
> for each subsequent disk (replacing X with b, c, d etc...)
> 
> quick and easy identical partitions on all disks.

I just use dd for this. Here are my notes for remirroring
a replacement disk in a software RAID1 array:

gooddisk=sda
baddisk=sdb

# To see which is the active disk:
cat /proc/mdstat

# To do a quick check of the new disk first:
badblocks -s /dev/$baddisk

# Do a dd to mirror partition table:
dd bs=512 count=1 if=/dev/$gooddisk of=/dev/$baddisk

# To tell the kernel to reread the new partitions:
blockdev --rereadpt /dev/$baddisk

# To tell the kernel to resync the raid:
mdadm /dev/md0 -a /dev/$baddisk1 #returns immediately
watch cat /proc/mdstat #estimates 6 hours for 230GB disk

#Finally, to mirror grub to both drives:
for dev in 0 1; do
echo "
root (hd$dev,0)
setup (hd$dev)
" | grub --device-map=/boot/grub/device.map --batch
done




More information about the ILUG mailing list