SW RAID1 rebuilding notes

Situation:

2 S-ATA disks as SW RAID1 mirror:
/dev/sda1 and /dev/sdb1 make /dev/md0 mounted on /boot
/dev/sda2 and /dev/sdb2 as swap
/dev/sda3 and /dev/sdb3 make /dev/md1 mounted on /

/dev/sdb died and just got replaced.

To rebuild the redundant configuration, these steps should satisfy:

sfdisk -d /dev/sda | sfdisk /dev/sdb
grub-install /dev/sdb
mdadm --manage /dev/md0 --re-add /dev/sdb1
mdadm --manage /dev/md1 --re-add /dev/sdb3
mkswap /dev/sdb2
swapon /dev/sdb2

Wait for the re-sync to be finished: cat /proc/mdstat

Done.


From: IBCL BLog.
Originally posted: 2008-12-26