• Sharebar

grubiconI had to re-install Windows on my partition and in the process it was obvious that I was going to lose my Grub. However, I knew I could very easily get it back. You can lose grub for various reasons and the most common being installing windows, which unfortunately doesn’t respect your settings and erases your grub. However, there’s nothing to panic in that case because restoring grub is no rocket science.

Let’s see how to restore grub on a machine which has Ubuntu:

1. Boot using a Live CD or pen drive of Ubuntu. You’ll be having a live session running.

2. Start a terminal Window by hitting ALT+F2 and typing gnome-terminal.

3. On the terminal window type the following command:

sudo grub

You’ll see the prompt changing in the terminal window.

4. At the grub prompt, type the following:

find /boot/grub/stage1

This should show you info about location

grublocation

5. As I got (hd0,5) in my case, following is what I am going to enter at the grub prompt:

root (hd0,5)

and hit enter

grubroot

6. Next we’ll install the grub at the mbr using the following command:

setup (hd0)

You’ll see the confirmation of installation of Grub.

grubinstall

7. Type quit to exit grub prompt. Close the terminal window and restart your computer.

You’ll have your grub restored.