Tuesday, March 13, 2012

Restore the Windows bootloader to MBR after dual-booting with Linux


If you are reading this, you have likely attempted or actually set up a dual-boot system between your favorite Linux distribution and Windows. And if you did that on a computer with a single hard drive, that is, dual-booting Windows and Linux alongside each other, you probably replaced the Windows boot loader with GRUB, the Linux boot loader, in the Master Boot Record (MBR).
Though that is not what I recommend, many still prefer it that way, even as I have written in many of my dual-boot tutorials that Windows will, during a reinstall, overwrite anything it finds in the MBR, and that some anti-virus programs tend to write small files to the MBR, messing up GRUB.
For the record, my recommendation is to install the Linux boot loader, not in the MBR, but in the Linux installation’s boot partition, or the main partition, if /boot is not on a separate partition. This gives the Windows boot manager the main responsibility of presenting what operating system to boot into during a restart or reboot.
That way, if you have to reinstall Windows, you will not lose access to the Linux side of the dual-boot system. If you installed the Linux boot loader to the MBR and want to restore the Windows boot loader, this short tutorial shows you how to do it. It is an easy, point-and-click process. And the application that makes it that easy is called EasyBCD, a free-for-personal-use application from Neosmart Technologies.
To download it, go here. The link to download it for free is all the way at the bottom of that page, so scroll down and click on the “Download free for limited, non-commercial use” link. After the download, install it as you would any other Windows application.
EasyBCD’s main view is shown in the screen shot below. To restore Windows 7′s boot loader to the MBR, click on the BCD Deployment tab.
Neosmart EasyBCD Main
Once there, click on the Write MBR button. If you are running Windows XP, select the option under MBR Configuration Options
Neosmart EasyBCD BCD Deployment
If successful, a message at the bottom left of the window will say just that. That was easy, right? But that also means that you have lost GRUB. If you reboot without doing anything else, you will find that there is no way to boot into the Linux side. If you do not want to continue using the Linux installation, then you do not need to do any thing else from EasyBCD. You might want to delete the Linux partitions to free up space for use by Windows.
If, however, you still want to be able to boot into the Linux installation after restoring the Windows boot manager to the MBR, you need to add an entry for the Linux distribution in the boot manager’s menu. To do that, click on the Add New Entry tab.
EasyBCD Restore Windows Boot Loader
While there, click on the Linux/BSD tab, then select “GRUB 2″ from the “Type” dropdown menu. Modify the “Name” field to reflect the name of your Linux distribution. Click the Add Entry button. Click Edit Boot Menu tab to see the new entry. Note: Most Linux distributions use GRUB 2 as the boot loader. If yours uses GRUB Legacy, select it from the same dropdown menu, and be sure to specify what partition it is installed into from the “Device” dropdown menu.
EasyBCD Add Linux Windows Boot Menu
You should see two entries. One for Windows 7, the other for the Linux distribution. You may change the boot order. If you are satisfied with this operation, exit EasyBCD and reboot the computer.
EasyBCD Windows Boot Menu
You should see the Windows boot menu that you saw on the first page of this article. This last image was taken from a tutorial written for Chakra. You may read it at How to dual-boot Windows 7 and Chakra Linux Archimedes, with shared NTFS partition at the end.
Windows 7 Boot Manager Menu
Bonus Info – What do you do, if after setting up a dual-boot system between Windows and Linux you decide that you no longer what to use Linux? Easy! Delete the Linux partitions. How?
Boot into Windows and start the partition manager (type “partition” into the menu’s search field and click on the result). This screen shot is from a test installation I did. The Linux partitions are indicated in red.
Windows Partition Manager Linux Partitions
To delete them, right-click on each and select “Delete Volume” from the context menu. That is all you need to do.
Windows Partition Manager Delete Linux Partitions
What if you decide, after playing with Linux for a while, that you like it better than Windows, and want to get rid of Windows? Well, because Windows is sitting at the front part of the hard drive, the best solution is to reinstall your Linux distribution, completely wiping both Windows and the original instance of the Linux distribution from the drive. Before doing it, be sure to back up your data.

No comments:

Post a Comment