Reinstall Ubuntu after Windows wipes it out!

Posted: December 20, 2008 in Uncategorized
Tags:

If your install of Linux is a dual boot setup with windows you have run into this problem before.  You reinstall windows and suddenly you can no longer access your Linux partition or the Grub bootloader. You can always go through the entire install of Ubuntu again, or you can try to repair the bootload, but how do you repair the bootloader?

Well if you have the live CD for which ever distro you are using (that installed Grub) it is quite easy and can save you hours of reconfiguration as well as install time.
1. Find your Live CD and boot it up (set your BIOS to boot from CD first, or if your BIOS allows it you can select the boot device.
2. After the Live CD does its thing you will need to open a terminal screen and type in the command: sudo grub.  This command will bring you into the grub prompt

3. Type the following commands assuming sda0 is which ever partition you are using (hd0,0 would be first hard drive and first prompt, hd1,1 would be the second hard drive and second partition).

> root (hd0,0)
> setup (hd0)
> exit

4. Reboot the system and remember to remove your Live CD before your system reboots

5. At reboot you should now see the Grub boot loader along with all your previous setting.

If with the new setup you now see Ubuntu but no longer see a windows menu item follow the following steps.

If Ubuntu was installed before your Windows version there will be no information in the Grub configuration for your windows setup. To get windows setup in Grub you will need to do a bit more tweeking.

Boot into Ubuntu and run the following command:
sudo gedit /boot/grub/menu.lst

Inside this file you will see an example for a windows choice for when Grub runs.  *COPY* the example and remove the “#” from the beginning of each line

# title   Windows 95/98/NT/2000
# root   (hd0,0)
# makeactive
# chainloader   +1
Remember you will need to change the hd0,0 to which ever if your windows partition, it may take a few try’s, but if you were able to select the correct partition for Linux when resetting up Grub you should be able to figure out the correct partition for Windows.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s