We generally use RAID1 arrays for the "/boot" partition of our servers for redundancy. RAID1 means that the partitions are all identical, and therefore all the drives hold the information necessary to boot. So we take /dev/sda1 and /dev/sdb1 and create /dev/md0 where we mount "/boot". Then we install grub in the MBR of both /dev/sda and /dev/sdb pointing it to the proper partition so that if the first drive fails, the second can boot in its place.
Grub v.1
The "normal" way to manually install grub version 1 would be to use the "root" and "setup" commands of the grub shell. So assuming our "/boot" partition is on /dev/sda1 and /dev/sdb1, we'd rungrub
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit
The problem with this is that we've told grub on /dev/sdb (hd1) to look on the first partition of the SECOND drive for its files. But if the first drive fails, the existing second drive will become the first drive. So it won't be able to boot because there won't be a (hd1,0) partition for it to load its files from. It needs to load its files from (hd0,0) regardless of which drive actually boots.
The solution is to use the "device" command of the grub shell to tell grub that (hd0) is the drive we are installing into, regardless of it's present position. Then whichever drive boots, it will look for its files on its own first partition (hd0,0). So here's the commands we actually rungrub
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Grub v.2
Installing grub v.2 on multiple drives is A LOT simpler than v.1, at least if you are using debian or a debian clone. You simply run dpkg-reconfigure grub-pc and select the drives you want to install grub in. The install script takes care of the rest.
Now everything should be set up correctly. Disconnect the first drive and the second should boot with no problem (albeit with a degraded array).
Navigation
Search
Recent blog posts
- Installing OpenVPN on Ubuntu Natty
- apt-get remove old modules errors
- Cloning Drupal Sub-site
- GnuTLS error with FileZilla and vsftpd
- Installing grub on multiple drives
- Finding the fastest Debian repository
- Changing the console resolution in Grub2
- Lightning calendar plugin for x86_64
- Adding a CAPTCHA to a webform in Drupal
- Our High-Availability Setup

Comments
Out of interest, does
Out of interest, does grub-install /dev/sdb setup everything so when the first disk is gone, and the second disk "sdb" is now "sda" will it boot? or is the grub shell the only way?
Nope
It won't work correctly if you set it up that way because grub sees the second drive as (hd1) and sets everything up looking for partitions on that drive. But then when that drive becomes the first drive (hd0) the mapping don't work and it can't boot.
So you have the use the grub shell "device" command to tell grub that "/dev/sdb" is (hd0) so the mappings are set correctly. Then when that drive is seen as the first drive, grub can find everything in the proper partitions and it boots correctly.