Saturday, February 16, 2008

CentOS/RHEL and mdadm issues...

This little bitty had me going for about 20 minutes. One of the drives in my file server at home failed, it's got a RAID1 (with a spare) for /boot and a RAID5 for /. Removing the old drive from the array was easy:


mdadm --manage /dev/md0 -r /dev/sdc1
mdadm --manage /dev/md1 -r /dev/sdc2


Then, I shut the machine down, replaced the failed drive, and booted the server again. I figured this would do the trick:


mdadm --manage /dev/md0 -a /dev/sdc1
mdadm --manage /dev/md1 -a /dev/sdc2


But after both of those commands, nothing was printed to the screen... and it was obvious (from /proc/mdstat) that nothing had happened. Hrmm...

Google found me a forum where some Gentoo users were complaining about this problem. The solution?


mdadm /dev/md0 --add /dev/sdc1
mdadm /dev/md1 --add /dev/sdc2


The man page states:


If a device is given before any options, or if the first option is
--add, --fail, or --remove, then the MANAGE mode is assume[sic]. Anything
other than these will cause the Misc mode to be assumed.


Nice.