Dec 022010
 

Linux software RAIDs are very useful, but a lot of people seem to have trouble when they need to boot from an array. They just don’t grok Grub well enough to get it installed properly. It’s especially common to see everything work fine until one of the drives fails. Then they realize that Grub was only installed on one of the disks in the array (the one that failed) and it doesn’t boot anymore. The correct process isn’t tricky, but you have to know the right commands.

I typically configure my servers with a 2-disk RAID1 mirror. This means each disk is an exact duplicate of the other. Installing Grub on both disks ensures that I’ll be able to boot no matter which disk happens to fail. Assuming that the array is built from /dev/sda and /dev/sdb, and that /boot is the first partition on each drive, start grub and then run:

device (hd0) /dev/sda
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)

What this does is tell Grub to pretend that each disk is the first disk in the system (which would be true if the other hard drive fails). Then it specifies the first partition on the first disk as /boot and installs Grub.

Should you have a larger number of disks in your array, simply repeat the three commands for each disk.

Finally, don’t forget to re-install Grub on the new disk whenever you have to replace a failed drive!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(to be displayed above your comment)

(for moderation; your e-mail address will not be made public)