Restore ubuntu after installing windows
I saw an article on recovering lost ubuntu after installing windows. I was pretty confident and installed windows 7 on my box. After that I started following the article and I was stuck with a blank grub menu during startup.
I booted from ubuntu live DVD and started reading more about restoring grub. Here is a solution I came up with.
Its a step by step guide to restoring ubuntu.
(Note: Its for Grub2. I am using Ubuntu 10.04)
Step1: Boot using Ubuntu Live CD/DVD.
Step2: Open terminal. (Press Alt+F2 and write gnome-terminal)
Step3: Now you need to mount your root partition. You can see a list of partition by typing sudo fdisk -l
Step4: Now mount the root partition sudo mount /dev/sdXY /mnt
Example: sudo mount /dev/sda6 /mnt
Where sda6
is the partition where I had my ubuntu’s /
installed.
Step5: If you had a separate boot partition. Then mount it in /mnt/boot
using command sudo mount /dev/sdXZ /mnt/boot
Example: sudo mount /dev/sda8 /mnt/boot
Step6: Now install grub sudo grub-install --root-directory=/mnt/ /dev/sdX
Example: sudo grub-install --root-directory=/mnt/ /dev/sda
where sdX is your first hard disk from where your system boots Or where MBR is located.
Step7: Restart your computer. It will automatically boot into your old ubuntu.
Step8: Open terminal and execute sudo update-grub
Step9: Restart your system.
DONE