Friday, November 12, 2010

Recovering Grub after installing Windows

Well i´ve had a lot of headache on recovering my grub. IF uǘe got a similar problem, i´ve got this simple solution that worked great.
If you run a dual-boot system with Ubuntu and Windows, this has happened to you. You had to do your monthly reinstall of Windows, and now you don’t see the linux bootloader anymore, so you can’t boot into Ubuntu or whatever flavor of linux you prefer.
Boot off the live ubuntu cd
Go to places
here 52gb file system is where i have my ubuntu installed.Click on it.

Your Ubuntu partition is now mounted. You will need to use terminal:

Verify if your partition is correct.
mount | tail -1 
You should see output similar to this:

/dev/sda2 on /media/0d104aff-ec8c-44c8-b811-92b993823444 type ext4 (rw,nosuid,nodev,uhelper=devkit)

To make sure this is indeed the Ubuntu boot partition, run ls /media/0d104aff-ec8c-44c8-b811-92b993823444/boot
you will see something similar to this:

config-2.6.18-3-686      initrd.img-2.6.18-3-686.bak
grub                     lost+found                   vmlinuz-2.6.18-3-686
initrd.img-2.6.18-3-686  memtest86+.bin
Now we just need to reinstall GRUB by specifying the correct directory and the correct drive name:
sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda
If all went well, you should see something like this:
Installation finished. No error reported.
Thats it.
Now restart your computer by removing the cd..
Hope it works well...

Boot off with your live cd.
Open terminal
sudo grub
You will get a screen showing
grub>find /boot/grub/stage1
This will give you the partition where ubuntu is present. I´ve taken it as 2nd partition.So i´ll get
Now type: 

And now restart your computer by removing the cd.


No comments:

Post a Comment