4/18/07

Restore grub on dual boot machine

If you have install windows and linux on the same hard disk and you choose GRUB as boot loader.At boot time you see a menu to choose windows or linux.
But one day you reinstall windows, it rewrites your MBR and grub menu has gone, now you only can boot windows.

What to do, to bring back grub menu
1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty.
3. Type "grub"
now you need to tell grub where are the grub images files
4. If you know where they are,Type sth like "root (hd0,3)". Remember that for grub (hd0,3) means hda (primary controller master), fourth partition(hda4). But if you don't know,type "find /boot/grub/stage1". You'll get a response like "(hd0)" or in my case "(hd0,3)". Use it for the root command parameter.
5. Type "setup (hd0)" to write GRUB to the MBR.
6. Quit grub by typing "quit".
7. Reboot.

Note: If you've installed GRUB into the Root Partition instead of the MBR, the commands are a little different. GRUB recognizes that the images lies under the directory /grub not /boot/grub.
Then if 'find /boot/grub/stage1' does not find the file, try 'find /grub/stage1'

0 comments: