Installing GRUB on both hard drives members of a RAID1

Installing GRUB on both hard drives members of a RAID1

By default, grub only instals itself on the first hard drive, no matter how many members there are in the RAID1 array.

One can easily install the grub bootloader on additional members of the RAID using the setup (hdX). Unfortunately, in case hd0 actually fails, as far as grub is concerned, the left members will still be looked at by their hd1, hd2… designations, although this is no longer the case from the kernel’s point of view. This will cause the boot process to fail, unless one can recover the first RAID member (hd0).

Using the sequence below will make grub treat all RAID members as hd0, so in case of a failure, any functional hard disk can take over for hd0, keeping the RAID bootable.

Grub’s stages are located in either /grub/stageX or /boot/grub/stageX, depending on whether your boot folder is on a separate partition or on the root one.

(root@server) # grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
grub> find /grub/stage1
grub> device (hd0) /dev/sdb Tell grub to assume that "(hd0)" will be "/dev/sdb" at the time the machine boots with missing raid members.
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

This sequence can be repeated for as many members as the RAID1 array has.

Sources: (1). (2)

Leave a Reply