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
Step7- Now all the files that are required had mounted and ready to install GRUB boot loader.
(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.
Continue Reading...
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.