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  System.map-2.6.18-3-686
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...
SOURCE :
https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

ANOTHER METHOD:
Boot off with your live cd.
Open terminal
Type:
sudo grub
You will get a screen showing
grub>
Type:
 
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
root(hd0,2)
Now type: 
grub>root(hd0,2)
grub>setup(hd2)
grub>exit  


And now restart your computer by removing the cd.
 

SOURCE:net





No comments:

Post a Comment