Recovering Windows boot-ability from Linux

When setting up a friends PC with Linux the other day, I decided to begin by partitioning the hard drive with the install CD. I learned that parted is a great tool to create partitions but it also tweaked my Windows install making it unable to boot. I’ve also heard of this happening on the occasional install of other distro’s where the MBR will be written incorrectly. Fortunately though I did the research and was able to fix it. Here’s what I did:

Anyone that has been around Linux long enough has seen this problem before. There are two types of errors that can cause Windows not to boot properly. First there is a damaged MBR. The MBR (Master Boot Record) is a 512-byte sector at the beginning of the disk that holds the partition table and the information for bootstrapping an Operating System. And second possibility is the partition boot sector (NTFS, FAT…) becoming corrupted. The partition boot sector is part of a metadata file that begins at the initial 512 bytes of the partition and followed by several others sectors which are called by the boot sector’s IPL (intial program loader). If either one of these are broken, Windows will not boot.

Now, if Windows is reinstalled or there is a mis-configuration with Grub, Grub will need to be correctly setup and installed back into the MBR as the bootloader.

If say the Linux partition is deleted, Windows will fail to boot because the program (Grub) and it’s configuration file are stored there. If this is the case, Windows needs to be put back in charge of the MBR. You’ll need the Windows Install Disk to do this, or sometimes the recovery disks will do. If the computer didn’t come with Install Disks or Recovery disks (as they do sometimes nowadays) then TestDisk might be an option. Read below.

However if Grub and MBR are set up correctly, then the partition boot sector needs to be repaired (this is what happened to me). This can be done in two ways I know of with TestDisk or ms-sys.

TeskDisk Success

Warning: I’m not an expert in using this program, so keep in mind that setting the wrong options could make the problem worse, but this did work for me.

TestDisk has the capability to rebuild the NTFS boot sector and recover a FAT one. Start TestDisk and select the disk then partition table type. In the “Advanced” option select the partition Windows boots from then select the “Boot” option. TestDisk showed the Boot sector as OK and the Backup boot sector as bad, funny I thought that it would be opposite. I had no choice though (besides a clean install of Vista [I hadn’t heard of ms-sys at the time]) and choose to rebuild it anyhow. I rebooted the computer and got my Vista back.

Fix Boot with ms-sys (Untested)

An alternate method of fixing the MBR is using the ms-sys program. I have yet to try this but alot of feedback at this post makes it seem to work pretty well. I’d like to hear feedback.


2 thoughts on “Recovering Windows boot-ability from Linux

  1. Pingback: Helpful Linux Tidbits

  2. Pingback: Gentoo Quick Install | shahverdY

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s