Wednesday, 14 November 2012

Fix MBR (Master Boot Record - Windows boot manager) after messing the grub boot manager when dual booting windows 7 and ubuntu and reconfigure it using EasyBCD

This time I decided that instead of installing Ubuntu using wubi with Windows 7, I'll dual boot the daily build of elementary os with Windows 7. I downloaded and boot eOS using a bootable usb using plop boot manager. Everything went smooth but I wrongly installed the grub over Windows 7's MBR at /dev/sda.

Grub became the boot manager and there is also windows 7 entry at the grub boot menu along with eOS menu entry. But when we select windows 7, it again comes to the first shown grub boot menu. So it created an infinite loop for the windows 7 and I was not able to boot to windows 7.

The next step was obviously restoring the MBR so that I can boot into Windows 7 and also keep the eOS along with windows 7. So how did I achieve this?

Firstly I restored MBR by booting with Windows 7 installation dvd. Then I select "Repair your computer" option and get into "command prompt". Then type the below two commands.

bootrec /fixmbr

bootrec /fixboot

Then reboot your computer. This will restore your MBR but will also remove the Grub boot manager. So you will no longer be able to boot into your eOS or ubuntu installation. But you can restore the grub after booting to windows using an amazing utility called EasyBCD. It is free for the personal use but you need to purchase the license for the commercial use.

According to wikipedia,

EasyBCD is a program developed by NeoSmart Technologies to configure and tweak the Boot Configuration Data (BCD), a boot database first introduced in Windows Vista. EasyBCD can be used to set up multi-boot environments for computers on which various versions of Windows, Linux, BSD and Mac OS X can be simultaneously installed; EasyBCD can also be used to add entries to bootable tools and utilities, as well as modifying and controlling the behavior of the Windows boot menu.

So once you have restored MBR, you can download and install EasyBCD in your windows 7 installation, then you can select the option "Edit Boot Menu" and rearrage it according to your need. I have moved the elementary os to the default boot option (first boot menu entry), then Windows 7 and then EasyBCD Bios Extender. So I'll be boot to eOS if I haven't selected any other option while booting my computer.

Restore Grub and Linux boot entry in MBR

Edit the boot entry and make Linux the default

I have written this mostly as a note to myself. But I hope this will also be helpful to others.

UPDATE: We can restore MBR using linux live cd also. You can find the post here.

No comments:

Post a Comment