System

How to Set up GRUB to boot from both disks of mirrored RAID

On Linux software RAID 1, or mirrored RAID, GRUB reads its program and configuration from the primary hard disk at boot. We can also configure it to read them from the secondary disk if the primary fails. This could be called making GRUB highly available on mirrored RAID. Assume the system has two SATA, SCSI, or SAS disks named sda and sdb, with sda as the primary and sdb as the secondary. Follow these steps: Edit /boot/grub/device.map so GRUB treats sda and sdb as the same hard disk.

cat /boot/grub/device.map

(hd0) /dev/sda (hd0) /dev/sdb Enter the GRUB shell with:

grub

In the GRUB shell, enter the command below to define hd0. grub> device (hd0) /dev/sdb grub> root (hd0,0) Filesystem type is ext2fs, partition type 0xfd Then enter the following command to install GRUB on sdb. grub> setup (hd0) Checking if “/boot/grub/stage1” exists… yes Checking if “/boot/grub/stage2” exists… yes Checking if “/boot/grub/e2fs_stage1_5” exists… yes Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 15 sectors are embedded. succeeded Running “install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst”… succeeded Done. After completing the steps above, leave the GRUB shell with quit. grub> quit Note: After this change, running grub-install on sdb will not work because GRUB does not allow more than one hd0.

grub-install /dev/sdb

The drive (hd0) is defined multiple times in the device map /boot/grub/device.map

EOF.← Back to articles