Grub
Software Raid 1
This is an example of what the process looks like. This machine has two SATA hard drives, /dev/sda and /dev/sdb. The first partition on each drive (i.e. /dev/sda1 and /dev/sdb1) make up a software RAID-1 which is the machine's /boot filesystem.First I'm going to show a "normal"Normal grub install, where the bootloader is being installed on the real first hard drive in the system.
(root@server) # grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> find /grub/stage1 #Find the partitions which contain the stage1 boot loader file.
(hd0,0)
(hd1,0)
grub> root (hd0,0) #Specify the partition whose filesystem contains the "/grub " directory.
grub> setup (hd0) #Install the boot loader code.
grub> quit
If
Software you'veRaid ever had to install grub by hand, you will recognize these commands shown above. As you can see, both /dev/sda1 and /dev/sdb1 contain the grub files.
Below is an example of installing grub on the second hard drive, with boot code which will work when it happens to be the first hard drive in the system. The one extra command is highlighted with a red background.1
(root@server) # grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> find /grub/stage1
(hd0,0)
(hd1,0)
grub> device (hd0) /dev/sdb #Tell grub to assume that "(hd0)" will be "/dev/sdb" at the time the machine boots from the image it's installing.
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Check if installed on disk
dd bs=512 count=1 if=/dev/sdX 2>/dev/null | strings |grep GRUB