08.04
This note relates to:
- grub2 version 1.98
- Ubuntu 10.04
- Windows 7
Reference: Ubuntu Guide
If you install (or re-install) Windows after you have been using Linux for a while, you might find out that the disk’s MBR (Master Boot Record) has been overwritten to point directly to Windows. This notes explains how to set up the MBR to point to the original grub.
Here are the general steps:
- Boot from Ubuntu Live CD
- Figure out which partition holds your GRUB boot
- Recover MBR
- Add new version of Windows to GRUB
Following are the steps in details.
Find your Ubuntu 10.04 Live CD and Boot from it
Self-explanatory. In theory, any live CD that uses Grub 2 should work.
Figure out boot partition
Using a partition editor, you can review the available partitions and remind yourself the name of the partition where the boot is located. On the Ubuntu Live CD, “gparted” is the command. It is available under the System > Administration menu.
You can add “gparted” in a Debian-based system with the following command:
Restore Master Boot Record (MBR)
Run the following commands, substituting with the correct partition names:
mount /dev/sda3 /mnt
mount /dev/sda2 /mnt/boot #skip this one if not have a separate /boot partition
grub-install --root-directory=/mnt/ /dev/sda
After this, remove Live CD, close tray and reboot. The original grub2 should load.
Add Windows to Grub2
Re-running the “update grub” should allow grub2 to discover Windows:
That should do it. Good luck.
“sudo update-grub” cannot discover Windows if on different disk.