Friday, June 4, 2010

Reinstall GRUB2 after installing Windows

If you install Windows after installing Linux, windows will erase Linux's GRUB. You have to re-install GRUB which will allow you to boot both Windows and Linux.

Reinstalling GRUB legacy was very easy but now with GRUB2 you have to do little more.

Follow the steps below, you need to know where your '/' (root) partition is. 

Boot your computer from Ubuntu Live CD.
Choose 'Try Live CD'
Once the desktop loads, Open Terminal from Applications menu -> Accessories
Type: sudo  fdisk -l
From here you can figure out your root partition.

Now if your root partition is /dev/sda1 follow the following commands below:
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc

Now chroot to /mnt:
sudo chroot /mnt

Now install grub:
grub-install /dev/sda

Now update the grub:
update-grub2 && update-grub

Now you will see the GRUB and can boot between Linux and Windows. If you don't see the Windows option in GRUB menu, open the Linux that is present in GRUB and run the last command of this tutorial.

0 comments:

Post a Comment