Tuesday, August 14, 2007

Mdadm problems adding disk back to software raid array

What you did should have worked. But since it didn’t, now would be a good time to backup anything of value on the system.

If the problem persists after a clean reboot, try adding the missing raid members after booting into rescue mode or booting using the CentOS Live-CD, but don’t search/mount/chroot the installation. Rescue mode will probably not start the raids without search/mount, so:

# mdadm -A --run /dev/md1 /dev/sda2
# mdadm /dev/md1 -a /dev/sdb2


If you still cannot add the missing members, try recreating a raid1 from rescue mode or Live-CD:

# mdadm -S /dev/md1
# mdadm -C /dev/md1 -l1 -n2 /dev/sda2 missing
# mdadm /dev/md1 -a /dev/sdb2


If that doesn’t work, overwrite the first few MB of the sdb partition(s), reboot and try adding it/them again.

# dd if=/dev/zero of=/dev/sdb2 bs=1M count=8
# init 6
# # After reboot
# mdadm /dev/md1 -a /dev/sdb2


If at any point you reassemble the raids, it would be a good idea to let them rebuild before rebooting.

No comments: