Tuesday, September 6, 2011

How to recover GRUB after Microsoft Windows Installation ?


I have been asked so many times by the linux newbies "How to recover GRUB after installing XP or windows 7 ?".

To make the Linux distro working (booting) after installing windows on the other partition, we need to re-install the GRUB again. You need a Ubuntu live CD for this purpose. Boot your system with this live CD. Open command line terminal (Application-> Accessories-> Terminal). I am assuming that windows is on first partition and Linux's "/" on second partition. Run the following command.
$ sudo mount /dev/sda2 /mnt
$ sudo grub-install --root-directory=/mnt /dev/sda

The above commands will install GRUB. Now boot your system with the HardDisk. When the system is booted up open the terminal and run the following command.
$ sudo update-grub2
The above command will add an entry for windows  operating system in the grub config file.

3 comments:

  1. Thanks sir,
    It has helped me a lot in resolving the issue.

    ReplyDelete
  2. Useful Post. But One doubt which linux os you used? and which version of ubuntu need?

    ReplyDelete