Recovering Windows Boot [Linux]
When setting up a friends PC with Linux the other day, I decided to begin by partitioning the hard drive with the Gparted Live CD. I learned that Gparted 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 Ubuntu and 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 misconfiguration with Grub, Grub will need to be correctly setup and installed back into the MBR as the bootloader. Catlett writes a good guide about this.
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. Meierfra, at the Ubuntu forums explains how to do that. 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 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 oppposite. 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
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.