Paul Labis: This is a personal blog where everyone can read my experiences, ideas and thoughts about programming, latest gadgets and other information technology related topics, lifestyle and many other stuff I would like to share to the public.

Recover Ubuntu Grub2 After Windows Installation

A month ago I decided to dual-boot my laptop with windows 7 and Ubuntu 10.04 version as my main operating system. So I first installed Ubuntu 10.04 then Windows 7 afterwards. After installing Windows 7, ubuntu distribution isn't accessible. I am not sure but I think Windows installation might have wiped out Ubuntu grub.

To be able to recover Grub2 menu along with the option to select either which operating system you want to use, I did the following recovery steps below.
  1. Boot from Ubuntu Live CD - any Ubuntu distribution is okay to use for as long as you get access to linux terminal or bash shell.
  2. Run command "sudo fdisk -l" - this is to find out where your Linux distribution is located or installed.  For instance, in the image below, my Linux is installed on sda1.
  3. Run command "sudo mount /dev/sda1 /mnt" - this is to tell Grub that your primary Linux is installed on such location. It should be pretty strait forward.
  4. Run command "sudo grub-install --root-directory=/mnt/ /dev/sda" - this is to re-install/restore  your Grub2 menu with option to boot to your Windows 7 operating system.
  5. Reboot your system either on GUI or bu running commands(eg. sudo shutdown -r now). You can already remove the Live CD now.
  6. After reboot, you should update Grub2 by running command "sudo grub-update".
That is all you need to do! Easy isn't it? Unlike other ways, the steps above are simplest because you don't need to edit files. 

I hope you find this article helpful and thanks for reading.
Like everyone else, I also did research and all credits to ulyssesonline.