ソフトウェアRAID(RAID1)で2台目のHDDでブートする方法

今日、こないだ作ったサーバのHDD(/dev/sda)が1台壊れた。で、とりあえず再起動してしまえと思ってrebootしてしまってさぁ大変。もう一方(/dev/sdb)のMBRgrubがインストールされてなかった、起動しなくなってしまった。先輩を長時間拘束してしまうことに。申し訳なさ過ぎて泣きそうになった。なので、次は一人で出来るようにメモっておかなければ。

下2つの記事がわかりやすかった。とりあえずまとめると、

# grub
device (hd0) /dev/hda
root (hd0,0)
install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst


device (hd0) /dev/hdb
root (hd0,0)
install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
install /boot/grub/stage1 d (hd0) /boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst
quit

こんな感じのことやれば良いらしい。