Dualboot Problem: How to Recover Ubuntu (Linux) After Installing Windows



Using Ubuntu installation CD

This section explains how to use the Ubuntu installation CD to restore GRUB (the GRand Unified Boot loader)

  • (1) boot press del key or f2, enter BIOS, check the “Advanced BIOS Features” in the first boot device is set to CD-ROM drive starts to exit and save the BIOS settings. Insert the CD into the drive.
  • (2) When the Ubuntu boot screen the boot: prompt, enter the rescue and then press Enter.
  • (3) Select the language regions (countries) and keyboard layout, like a fresh installation of the same.
  • (4) Enter the host name, or use the default (Ubuntu)
  • (5) Select the root partition (the screen will display a list of the partitions on the hard disk, so you need to know which partition to install Ubuntu on). Should be shaped like dev/discs/disc0/partX, where X is the partition number.
  • (6) You will then enter the command line (a hash).
  • (7) Enter $ grub-install / dev / hdaX X is your root partition where Ubuntu.

Use Ubuntu Live CD

Please select one of the following methods:

Using LiveCD, while retaining the Windows Bootloader

Keep in mind that this method will install GRUB to a hard disk MBR (Master Boot Record master boot record) above, but not installed in the root partition. For most people this is not a problem, unless you have another one boot manager.

In other words, if you use Boot Magic or System Commander boot manager like, then you see above command will overwrite your existing boot manager.

If you have to install GRUB to the root partition, the command will be something different. Here is my system I used.

When using Ghost to restore Windows, how to restore the Grub menu:

  • From the Live CD (such as Ubuntu Live, Knoppix, Mepis or similar) to start.
  • Open a terminal. Switch to super user (SuperUser). (In Ubuntu enter “sudo-i”, other than the Ubuntu releases enter “su”). Enter the root password.
  • Enter the “grub”, will appear GRUB command prompt.
  • Enter the “find / boot/grub/stage1”. Will appear as “(hd0)” kind of results is in my computer “(hd0, 3)”. In the following command to use your computer to get results.
  • Enter “root (hd0, 3)”.
  • Input “setup (hd0, 3)”. This is the key. In some other guides use “(hd0)”, if you want to write GRUB to the MBR, then use “(hd0)” is not a problem. If you want to write your Linux GRUB root partition, then you need to add a comma after the figures, shaped like “(hd0, 3)”.
  • Enter “quit”.
  • Remove the Live CD, restart the computer.

Using Live CD, while covering the Windows bootloader

  • From the Live CD to boot into the desktop.
  • Open a terminal or switch to a tty (Ctrl + Alt + F1).
  • Enter the “grub”
  • Enter “root (hd0, 6)”, that is your hard disk and boot partition number. (My boot partition (/ boot) in / dev/sda7, switch to grub is hd0, 6).
  • Input “setup (hd0)”, or your hard disk number.
  • Enter “quit” to exit grub.
  • Restart.

Do not use the Ubuntu Live CD

You can not use the Ubuntu Live CD, but directly from your hard drive to run “grub”. First you need to mount the root partition (the example below assumes that the root partition on hda1):

 sudo mkdir / mnt / linux
 sudo mount / dev/hda1 / mnt / linux

Then, enter the sbin directory and run grub

 sudo cd / mnt / linux / sbin
 sudo. / grub

Using unofficial “Super Grub Disk”

Note: This method is useful only for systems with only one Linux OS, and is very effective method. If you have more than one Linux system, then, Super Grub Disk will restore partition on your first one found Grub.

  • Download “Super GRUB Disk” (Google it to get latest version)
  • Burn it to cdrom
  • Boot from a CD
  • Choose: Your Language
  • Selection: The Grub restored to the MBR (Restore Grub on MBR)
  • Selection: Auto (Auto)
  • You will see this message: SGD has done it!
  • Restart
  • Complete

When to use all these methods:

These methods will applies to following situations —

  • After Windows is installed on Ubuntu dual-boot settings
  • Windows crashes lead to reinstallation
  • In Windows system recovery to restore the MBR
  • The case when it was not successfully installed GRUB


  • Your Ubuntu partition unaltered
  • Do you have a Live CD, for example, is Ubuntu Live CD, or any of your other favorite
  • You can expertly into the console via LiveCD
  • Do you remember how you set up the partition (with a good print / etc / fstab is the best, but you can also use fdisk-l / dev / hda output result)
  • If you use a non-Ubuntu kernel or compile your own kernel, then you will need a kernel is how to work-related knowledge, especially knowledge about the initr

 Prepare your work environment

The LiveCD into the CD-ROM drive and restart the computer. LiveCD startup programs continue to enter the working interface. If LiveCD does not automatically open a console (also called terminals), then you can manually opened. In Ubuntu, click the “Applications -> System Tools -> Terminal.”
Note: Because this is a LiveCD environment, so a user account here or file system changes are temporary. This means that you can not affect your actual installation case, set a temporary root user password and create the directory.

  • Gain root permissions:

On Ubuntu, you can use the following command:



In Knoppix, use the following command without entering the password.

 su –

Now that you have root permissions.

  • Mount the partition containing boot files.

You need to be able to access / sbin / and / boot / directory permissions. If the / boot / listed in your fstab file, you will need to mount two partitions. For your work environment to create a mount point – you’ll find it and create a directory is the same.

 mkdir / mnt / work

If you need to mount / boot /, you also need to run the following command.

 mkdir / mnt / work / boot

You can now load your file system. Review your fstab file and confirm the root directory (/) and / boot / directory location; should be similar to / dev/hda3 and / dev/hda4, but the letters and numbers 3,4 may be a result of your file system and different.
Note: The following parts are assumed to be / dev/hda3 and / dev/hda4, you should enter the time according to their own situation to make the appropriate changes. Enter the following command to load your file system and some GRUB need.

 mount / dev/hda4 / mnt / work mount-o bind / dev / mnt / work / dev
 mount-o bind / proc / mnt / work / proc
 cp / proc / mounts / mnt / work / etc / mtab

Now, you need the following command into your work environment.

 chroot / mnt / work / / bin / bash

Warning: From now on, you have to modify any of the files will affect Ubuntu system. You have left the LiveCD security environment. Caution.

Automatically restore GRUB

If your / boot / is independent of the partition, enter the following command.

mount / dev/hda3 / boot /

Here it is easy to reinstall GRUB. Enter the following command.

/ Sbin / grub-install / dev / hda

If you use the above command is not successful, (this is unlikely), you will need to manually configure GRUB (not difficult); If you use the above command is successful, you should read the last one – “Configuring GRUB menu “at the beginning of precautions.

Manually restore GRUB

Before you make the next step, you need to understand is how to distinguish between GRUB partition. For GRUB, the number starts at 0, the letter expressed in numbers, it starts from 0. For example, / dev/hda1 is in GRUB “hd0, 0”. Similarly, / dev/hdb3 is “hd1, 2”.
NOTE: If you have a / boot / partition, then, “root” command must point to your / boot / partition location. If you do not / boot / partition, pointing to your root partition.

 / Sbin / grub
 grub> root (hd0, 2)
 grub> setup (hd0)
 grub> quit

Configuring GRUB menu

Note: If you just want to restore your MBR, then there is no need for this step of the operation. Windows does not modify your original menu.lst content, so if everything is normal, then previously, should now also work correctly, you can restart the computer. Use your favorite editor to open the GRUB menu file / boot / grub / menu.lst. For example:

nano / boot / grub / menu.lst

Note: Your GRUB menu.lst file is used to control the operating system start-up display and the display appearance. Only the contents of this section explains how to start your operating system; does not help you to boot manager is set too beautiful. Here is a sample menu.lst, but deleting unnecessary comments. It is based on the previous example / dev/hda3 and / dev/hda4 assumptions, and also assumes that Windows is installed in / dev/hda1.
That’s it. Save and close the file, and then restart a try.


Leave A Reply