CentOS Software RAID Grub bug

Was working with an old CentOS 5.2 software raid and trying to replace the 70GB drives with 500GB drives. Had quite a bit of difficulty with grub not working when trying to boot on one drive or the other after repartitioning the drives.

This comment seems to have come to the rescue:
1) Connect both drives and verify that all drives are sync’d (i.e. “cat
/proc/mdstat”)
2) If not, add the missing drive (i.e. If /dev/sdb1 is missing, “mdadm /dev/md0
–add /dev/sdb1”)
3) Wait for drives to sync up.
4) grub
5) grub> device (hd0) /dev/sda
6) grub> root (hd0,0)
7) grub> setup (hd0)
8 ) grub> device (hd0) /dev/sdb
9) grub> root (hd0,0)
10) grub> setup (hd0)
11) grub> quit

After that, I tested booting from one drive and then the other, both were able to boot on their own – OK! On to growing the raid, after some fun with Knoppix Qparted to get the drives partitioned to use as much space as possible and keep swap at the end.

Somewhere along the way I had to set the partition type with the instructions found on this page
fdisk /dev/sdb
> t
> 1
> L
> fd
(sets partition 1’s type to Linux raid autodetect.)
Repeat for partition 2 (ie replace ‘1’ above with ‘2’)

Once I was (finally) able to boot from the repartitioned drives, ran this to increase the raid size:
mdadm -G /dev/md0 –size max
watch -d cat /proc/mdstat

then after things finished syncing up, ran this to actually get that space available:
resize2fs /dev/md0

Repeated steps 4 – 11 before rebooting to test that the raid can boot off either drive.

This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to CentOS Software RAID Grub bug

Leave a Reply

Your email address will not be published. Required fields are marked *