Tux Tip: Grub+md mbr
Scenario: System with two hard drives (sda, sdb) mirrored for redundancy.
The 1st drive in the BIOS is sda and the 2nd drive is sdb. Grub is installed on the MBR of sda during the O/S installation. We need it installed on the MBR of sdb as well in case the 1st drive fails and the system reboots.
The trick is the grub device command issued before the root and setup commands.
While the system is booted up with both drives operational type the following commands as root:
[root@myhost]# grub grub> device (hd0) /dev/sdb # Set (hd0) to be the 2nd drive for subsequent commands grub> root (hd0,0) # Root device (with /boot/grub) is 1st partition of 2nd drive grub> setup (hd0) # Write the MBR on the 2nd drive grub> quit
That's all.
Here's what my session looked like doing the same for hda,hdb mirrors, where the root command in /boot/grub/grub.conf is "root (hd0,0)":
grub> device (hd0) /dev/hdb
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub
.conf"... succeeded
Done.
grub> quit
