Grub and software raid-1

Christopher K. Johnson ckjohnson at gwi.net
Tue Mar 9 12:18:34 UTC 2004


Yusuf Goolamabbas wrote:

>What steps should one take to ensure that Grub correctly sets up the MBR
>on /boot if /boot is on a software raid partition. My understanding is
>that currently GRUB will only install itself on the first disk even if
>/boot is a raid-1 partition so if the first disk dies the system won't
>be able to boot
>
>Will Fedora Core 2 take care of this automatically ?
>
>Regards, Yusuf
>  
>
I can't answer for the "automatically" question.  But I can tell you 
what steps to take to configure the second disk's 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 at myhost]# grub
grub>   device (hd0) /dev/sdb   # This will set (hd0) to be the 2nd 
drive for the subsequent commands
grub>   root (hd0,0)            # This will set the root device to be 
the 1st partition of the 2nd drive (location of /boot/grub directory)
grub>   setup (hd0)             # This will write the boot information 
to 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

Chris

-- 
-----------------------------------------------------------
   "Spend less!  Do more!  Go Open Source..." -- Dirigo.net
   Chris Johnson, RHCE #807000448202021






More information about the users mailing list