Revert Ubuntu boot loader after installing Window 7

This post will describe to install Ubuntu GRUB boot loader after installing windows 7 on a PC that already Ubuntu installed. Also this is a problem that I faced after installing Windows 7. Suddenly my Windows 7 installation was crashed and I formatted Windows installed drive and reinstall the Windows 7. I was used Windows and Ubuntu installed on different drives as a dual boot. But after installing windows 7 Ubuntu boot loader was overwritten by windows boot loader and that boot loader does not list my Ubuntu installation. Therefore I could not select Ubuntu to load and windows boot loader automatically boot the Windows7 itself. To overcome this problem we have to overwrite GRUB boot loader on windows boot loader. Follow the steps that I explained bellow correctly to do that.

This method will copy boot settings from Ubuntu Live-CD in order to boot from GRUB boot loader.

Step1- Insert Ubuntu Live CD into CD drive and boot from it.



Step2- Click on 'Try Ubuntu' (on Ubuntu 11.04) to load Ubuntu from Live CD without affecting to your computer.










Step3- When Ubuntu Live desktop appear Run 'Terminal' (Application-->Accessories-->Terminal) to execute following commands.
Step4- In terminal type sudo fdisk -l
It will display all partitions on the hard disk with some details
Identify the partition which Ubuntu installed by checking 'System' column from the above result. The partition which has 'Linux' under system column is the partition of Ubuntu installed.

But here(in my computer) 3 partitions hold 'Linux' under system column. Therefore you should identify the correct partition. For that you can use 'Disk utility' software(it is already included in Live-CD session). Still complicated to identify the partition please be patient, it can be identify in next step.


Step5- Mount the Ubuntu partition drive
    sudo mount /dev/sdXX /mnt
    (Example- sudo mount /dev/sda9 /mnt)

Now go to Home directory(Place-->Home), go to root directory and go to mnt directory by double clicking. Make sure here the folders such as 'boot', 'opt', 'usr' and 'bin' etc exists on this directory(/mnt directory). If not you could not mount Ubuntu installed partition to the mnt, so unmount it and mount the correct partition to the mnt.(To unmount type sudo unmount /mnt)

Step6- If you have different partitions for boot, home, etc... mount them to each corresponding directory in /mnt directory.
Example- sudo mount /dev/sda3 /mnt/boot
                sudo mount /dev/sda10 /mnt/home
(to check whether you mount correct partition to the correct directory check out the content of each directories)

Step7- Now all the files that are required had mounted and ready to install GRUB boot loader.

sudo grub-install --root-directory=/mnt /dev/sda

(Note-That's /dev/sda the hard disk itself, not Ubuntu installed partition)
If it says grub-install is not a command then you had some mistake on mounting.

Step8- Unmount and restart
    unmount all the partitions that mounted.
    Restart the computer - sudo reboot


That's it. Now you can see the GRUB boot loader with all the installed operating system listed.

23 comments:

  1. If any error occurring such as "No such a device " when you select a option on GRUB menu try "sudo update-grub" command on ubuntu(not live CD session) to fix error.

    (That's mean your hard disk driver's UUID has changed some how.)

    ReplyDelete
    Replies
    1. Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download Now

      >>>>> Download Full

      Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download LINK

      >>>>> Download Now

      Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download Full

      >>>>> Download LINK NL

      Delete
  2. Fantastic article! to the point explained, rather than all the other things in the world.
    I had been struggling on this error. Though many articles explains this, the detailed explanation in step 5 of "yours" did make me put on the right path.
    I did not understand the linux partition and went and mounted the actual boot partition (the one with the *) and later found your article.
    The explanation of step 5 in your article is the highlight as that's the pain area.

    Thanks Buddy.

    ReplyDelete
  3. Today I installed Ubuntu 11.04 on a pc which Windows XP already installed on. Then Ubuntu installation did not install grub with xp and Ubuntu. After that I followed the same procedure that I explained in this article and it worked.

    Hope this will help to some body...

    ReplyDelete
  4. I installed Ubuntu 12.10 on my HP Laptop which has a Windows 7 (64 Bit) OS already installed. But after the installation of Ubuntu 12.10 I found that when I was trying to boot Windows 7 from the GRUB it was giving me a black screen & telling me to press CTRL + ALT + DEL to reboot but now giving me the access to my Windows 7 OS partition. Please help me.

    sgangopadhyay@hotmail.co.in

    ReplyDelete
  5. Thanks Mr. Milinda. this is really help full post . small suggestion , i had the same problem .after installing windows the boot loader does not appeared. what i did is i installed ubuntu inside windows (just allocate minimum space 3GB). finally i could see the all operating systems(it included my old linux version and also the new vertion too) list when booting.

    ReplyDelete
    Replies
    1. Thanks Mr. Rangana for you suggestion. However if you update the grub boot loader on your hard disk, then it will show your all operating system. (When you install Ubuntu again it will re-write the grub)

      Again thank you for sharing your experience with us!

      Delete
  6. I have the same issue. I installed Ubuntu 11.04 along side with Windows 7 in different partition. So when I reinstalled windows 7 due to some reasons, I can't access Ubuntu since grub is missing. So I followed your steps& when I typed "mount/dev/sda2/mnt" , it shows "command not found'. Plz help me in resolving this problem

    ReplyDelete
    Replies
    1. I think you missed spaces in your command. Note that you should have space between "mount" and "/dev/sda2" and space between "/dev/sda2" and "/mnt", follow this syntax,

      mount[space]/dev/sda2[space]/mnt

      Delete
  7. Thank you very much, your tuto help me a lot

    ReplyDelete
  8. Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download Now

    >>>>> Download Full

    Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download LINK

    >>>>> Download Now

    Milinda Pro: Revert Ubuntu Boot Loader After Installing Window 7 >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete