How to reinstall GRUB after overwriting your MBR
So tonight I decided to install FreeBSD 7.0RC1 and try it out. While I’m sure I chose to leave the MBR unchanged, it went ahead and overwrote my MBR with the FreeBSD boot loader.
Fortunately I always keep a copy of Trinity Rescue Kit (A Linux-based rescue CD) handy for times like these and was able to recover my Fedora 8 desktop by booting into Trinity, typing “grub” at the command prompt and then entering:
install (hd1,0)/boot/grub/stage1 d (hd0) (hd1,0)/boot/grub/stage2 p (hd1,0)/boot/grub/menu.lst
This assumes your Windows drive and partition are the first dive/partition on the first disk. I run Windows on a separate physical drive (Primary IDE or SATA 1) because Windows will only boot if it’s installed on the first physical disk in a system.
Your /boot/grub/menu.lst should be similar to (from my Fedora 8 box):
default=0
timeout=5
splashimage=(hd1,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.23.14-115-fc8)
root (hd1,0)
kernel /boot/vmlinuz-2.6.23.14-115-fc8 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.23.14-115.fc8.img
title Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1
Post a comment