Related Posts Plugin for WordPress, Blogger...

Wednesday, December 8, 2010

Restore or Reinstall Ubuntu grub after reinstalling Windows

If we reinstall windows on a Windows/Ubuntu dual boot system, we can not use Linux, until the Grub (GRand Universal Bootloader) is restored.

To restore grub, Insert the live CD/DVD of Ubuntu and restart the system to start a live session.




For Ubuntu versions 9.10 and above:

Then open a terminal from Applications --> Accessories --> Terminal and enter the following command.
Code:
sudo fdisk -l
You will see something like this:

http://i51.tinypic.com/2j67dd2.png


Select the drive in which root partition "/" is installed.. (Let us say /dev/sda5)

Then in terminal

still in the terminal, type:
Code:
sudo mkdir /media/sda5
sudo mount /dev/sda5 /media/sda5
And then, to reinstall the grub by entering:
Code:
sudo grub-install --root-directory=/media/sda5 /dev/sda
Of course you need to replace “/dev/sda5″ and “/dev/sda” with what you found in the fdisk output.


If you get BIOS warnings try:

sudo grub-install --root-directory=/media/sda5 /dev/sda --recheck

If everything is fine type in the following into terminal:

Code:
sudo reboot




For Ubuntu versions 9.04 and lower:

We need to open terminal from

Applications --> Accessories --> Terminal and enter the command.

Code:
sudo grub
Next,

Code:
find /boot/grub/stage1
Take note of what it returns (something like (hd0,1).)

Now enter

Code:
root (hda,b)
Replace a and b with what you got back before. For example, if "find /boot/grub/stage1" gives "(hd0,3)", you will run "root (hd0,3)"

Now run:

Code:
setup (hd0)
This is fine if you want to write GRUB to the MBR. If you want to write it to your Linux root partition, then you want the number after the comma, such as "(hd0,3)".



If everything is fine type in the following into terminal:

Code:
sudo reboot
Enjoy...



Please give your valuable comment for further improvement...


1 comment:

  1. NATIONAL INSTITUTE OF DIGITAL EDUCATION established in 2010 with the mission of delivering training to professionals in Computer Training. We offer a wide range of quality computer training.

    All our training courses are taught by professionals in the field, allowing you the chance to learn from experts within their respected industry, which provides you with a quality computer training that will help you take your knowledge and career to new heights. We have different courses to shoot-up the requirement of the general youths of West Bengal. The duration of the courses are segregated in Six Months, One Year & 18 Months. Students are awarded by CERTIFICATE which will accept all over India.
    -----------------------------------------------------------------------------------------------------
    Email: info@nideindia.in / nidedirector@gmail.com

    Website : http://www.nideindia.in , Facebook : https://www.facebook.com/NIDEofficial/

    Twitter : https://twitter.com/nideindia , YouTube : https://www.youtube.com/channel/UCDvV-Fhx9Tz3jDmeZu4EOUw

    Android App : https://play.google.com/store/apps/details?id=com.ntss.nide

    ReplyDelete