When 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.
nice article …really helpful…
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 🙂
How about writing it as another article mentioning it as GRUB 2 ??? 🙂
That would be great .
where to insert this commands specified for grub2?
What i have do if windows boot deleted but i have linux os ?
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.