Restore Windows 7 bootloader on GPT partitioned Hard disk
August 2012 : Erased my primary HDD and with it went all the OSs
August 2012 : Partitioned my HDD using GUID partition table, to install OSX Lion (for xcode development, and lack of money to get a real Mac)
August 2012 : Dual booted OSX & Win 7
October 2012 : Removed OSX after completing xcode development to accomodate Linux, for this semester’s studies.
GRAN PROBLEMA!
Win 7 was installed on a
GPT was still safe(duh! linux is GPT compatible), but the Win 7 bootloader needed to be recovered.
In goes the Recovery Disc, but to no avail due to GPT partitioned HDD.
Problem : Windows 7 lacks full support for GPT - ‘GUID Partition Table’ partitioning scheme (which replaces MBR - ‘Master Boot Record’) & UEFI firmware (which replaces BIOS).
Question: How did Windows get installed on a GPT partitioned HDD?
Answer: Via a workaround called MBR protected parition inside GPT.
Question: Why can it not recover the bootloader by overwriting the corrupt bootloader?
Answer: Recovery disc for windows 7 lacks support for protected MBR. (Stupid)
Question: What now?
Answer: Convert protected MBR to Hybrid MBR
Question: What’s Hybrid MBR?
Answer: It fools Windows into believing that the HDD is partitioned using MBR, however the MBR partions are just references to the existing GPT partitions (Ingenious! - Bootcamp on iMacs works this way, to install Windows beside OSX)
HOW???
1. Boot into linux (live distro works too)
2. install gdisk (GPT fdisk)
3. run gdisk <your HDD identifier here> e.g. “sudo gdisk /dev/sda”
4. print current partition table (press ‘p’)
5. note the partitions for Windows & Linux (1 will be EFI, 2/3 will be Windows/Linux)
6. press ‘r’ to enter the recovery menu
7. press h to Hybridize MBR
8. read warning carefully
9. enter the partition numbers for Windows & linux partitions (2<space>3)
10. press ‘o’ to confirm the new partition table
11. enter w to write the modified GPT to HDD.
12. reboot
Okay, does all that format the HDD?
Nope. The data is safe. Yes. Both Windows and Linux partitions are safe.
Now pop in that revoery CD and just run startup repair!
Voila! you’re done! Windows will be up and running in no time :)
