Actually, you can do this to rescue GRUB after you wipe the MBR for any reason.

Windows will install the NT loader in the root of the drive, not the partition, so we need to tell GRUB to install there. Also, the typical method of chroot’ing often does not work, because the devices will not map (/dev breaks). Of course, this depends on which devfs you are using.

Anyway, the most reliable way I have found is too boot any linux LiveCD, open a terminal, and just do:

$ grub –no-floppy
> GRUB Version 1.0
$ root (hd0,0)
$ setup (hd0)
$ exit

That’s it! The –no-floppy means don’t look to the floppy for a boot sector (makes GRUB a little faster to load). Also, you may need to sudo the initial grub command depending on your live CD.

The mapping for hd0 to the linux devices, is it is the 1st hard drive i.e. hda or sda. The partition numbers are 0 based, so instead of hda1-4 you have hd0,0-hd0,3. Make sure you get the device correct!

Written on July 21st, 2007 , Informative

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something is proudly powered by WordPress and the Theme Adventure by Eric Schwarz
Entries (RSS) and Comments (RSS).

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something

Personal jorunal of a professional geek – James Pearce in Perth, Australia