Linuxtipstricks – Just another /linux/blog

October 19, 2008

How to restore GRUB in your MBR if Windows changed it

Filed under: user tipstricks — Antonio Portuesi @ 7:29 pm
Tags: , , , , , , , , , ,

Once upon a time it was a GRUB (GRand Unified Bootloader) menu showing up itself after a normal Bios POST…

Then you said: Why should I do not another Windows release test?

It is over, during the last setup step Windows installer overwrite the MBR (Master Boot Record) and you cannot make a OS choice at boot time anymore.

And now?

Before you start please note that if you are not confident in what you are doing or in repairing or recovering from the above listed process, then do not step to the outlined instructions. Working with MBR is easy in almost all situations, this process does not carry out data loss, but there still exists a (however minimal) risk about that, so you should back up your data before attempting to modify your hard disk settings.

I cannot help you troubleshoot problems you could have following this tutorial.

Follow these steps, get back the control and come back a dual boot user.

First of all clear your mind and do not forget that this method puts GRUB back on the MBR of the hard drive instead of in the root partition. This is good for most of you, but not if you already have an alternative boot manager as Boot Magic or System Commander or Acronis OS Selector.

If you have installed GRUB into the root partition instead of the MBR, the commands are a little different. Here there is the procedure:

Boot from a Live CD, (Ubuntu, OpenSuSE, Mandriva, Gentoo, Fedora and so on)

Open a terminal. Go on as SuperUser (or use sudo command) and enter root password as requested.

user@domain:~$ sudo grub
user@domain:~$ password for user:

Then type:

grub> find /boot/grub/stage1

You will get a system response like “(hd0)” or in my case “(hd0,6)”

grub> find /boot/grub/stage1
(hd0,6)

Go on typing:

grub> root (hd0,6)

and:

grub> setup (hd0,6)

Pay attention here and stay focused: other troubleshoot instructions suggest you to type “(hd0)”, and that is good if you want to write GRUB to the MBR and not on the root partition. So this is up to you.

The final command let you exit the grub shell:

grub> quit

Now reboot the system and remove the bootable live media.

user@domain:~$ sudo reboot

I hope this guide will help you to gain control of you boot procedure.

Blog at WordPress.com.