Mirroring root

From PrgmrWiki

this is for a 4 disk raid1 md. first, I install grub the usual way on /dev/md0. After that I set partition 1 on all disks in the raid to bootable, and then I use grub to put the mbr on all of them. Grub seems to write to the disk, so just to be safe, when I am done, I rebuild the raid.

# grub
Probing devices to guess BIOS drives. This may take a long time.


    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> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0,0)
setup (hd0,0)
 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,0)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 p /boot/grub/grub.conf "... succeeded
Done.
grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1,0)
setup (hd1,0)
 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 (hd1,0)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd1,0)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd1,0) /boot/grub/stage2 p /boot/grub/grub.conf "... succeeded
Done.
grub> root (hd2,0)
root (hd2,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd2,0)
setup (hd2,0)
 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 (hd2,0)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd2,0)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd2,0) /boot/grub/stage2 p /boot/grub/grub.conf "... succeeded
Done.
grub> root (hd3,0)
root (hd3,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd3,0)
setup (hd3,0)
 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 (hd3,0)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd3,0)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd3,0) /boot/grub/stage2 p /boot/grub/grub.conf "... succeeded
Done.

now to make sure we didn't bork the raid

# cd /sys/block/md0/md/
# echo "check" > sync_action
# watch cat /proc/mdstat
# cat mismatch_cnt