DailyTUT Wallpapers

Restoring GRUB Boot-Loader After Windows Reinstallation.

bootusbWhen we have the Dual boot with Windows and Any other Linux Operating system, we may come across a situation to reinstall the OS of our machine. When you Re-install your Linux, It should be no problem as it can automatically map your windows back into her own Boot loader, let it be GRUB or LILO. But it’s not the same case with the Windows Re-installation with Linux parallel on the machine. Windows cant map your Linux partition into its boot loader, and hence we have to map it manually.

It is better to use the GRUB as the Boot loader commonly. Here follows the steps for Restoring the GRUB boot loader back after installing the Windows parallel with Linux in the machine.

Boot into a Live Session with any Ubuntu Live Disk.

Get into the Terminal, and run

sudo grub

Now the terminal will get into the GRUB prompt as following

grub>

First find the System Volume of our Linux installation. For this run the find command with the grub menu list directory to ensure the GRUB settings are still unaltered in the location.

find /boot/grub/stage1

Now it will be returning something as (hdX,Y), [ e.g. (hd0,0) ].

The X and Y will be a numerical value representing the Hard disk number and partition number of the Linux System Volume. From here onwards replace the upcoming X and Y with values that you got in this step.

Our next step is to restore the GRUB. To do that, enable the Root mode for the Linux System Volume access by

sudo root(hdX,Y)

Now run the setup command to restore the GRUB.

sudo  setup(hdX)

Now Quit the Grub Prompt by quit command and reboot to get the GRUB with all OS in your Machine.

Article by Rajkumar, an engineering student doing research in DSP. He is an open source freak, especially UBUNTU. You can find him active and supporting in UbuntuForums.

About the Author: Robin C

Security Consultant, Engineer, Technology Enthusiast and Blogger.

You May Also Like

6 Comments

  1. In grub2, There is another command that we must know for restoring grub. Goto terminal and do the following

    1)Mount the partition containing the Ubuntu installation.

    sudo mount /dev/sdXY /mnt

    2) Run the grub-install command as described below

    sudo grub-install –root-directory=/mnt/ /dev/sdX

    This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device. Nice work Raj Kumar 🙂

    1. Reinstall windows and follow the steps given above or in the comment given by @c18e26e9e91770c7eec21307990aa217:disqus to get the dual boot window back on track. hope this helps.

      Robin.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.