Thursday, January 17, 2008

Apple's Bootcamp bungles GPT specification

Ever wonder how Bootcamp works? Well, Apple has basically messed up the GUID partitioning standard to make it work with Windows, even though they could have just stuck with MBR and kept things simple. It is a horrible, horrible kludge. We finally figured out what this guy already found; partitioning and imaging a Macintosh is a real bastard, but possible. And no, Bombich's software (although pretty cool), just doesn't cut it when you already have a PC solution (Altiris Deployment) and a Mac solution (Xserve+NetInstall).

The GUID specification calls for a "protective MBR" with exactly ONE partition (with an ID of 0xEE). No matter how many partitions you create in the GUID table, there should only be ONE partition in the MBR table. ONE!

What Apple has done is make a hybrid GPT/MBR. In this case, "hybrid" is synonymous with "bastardized". Any partition you create (with apple tools) in the GUID table gets copied to the MBR table. This is why when you install bootcamp, you CANNOT remove the partition and recreate it; the geometry would not match what is in the GUID table. Once the two tables are out of sync, it's a real bastard to fix. ReFIT has a program called gptsync that will sync one way; GTP to MBR... but there is no reversal of that.

The really funny part is Apple's Tech Note from 2006 (probably just before BootCamp). They describe the Protective MBR as "a single partition entry (of type 0xEE) that covers the entire area of the disk used by GPT structures and partitions." A single parition? A Bootcamp Mac has three!

Furthermore, Apple mentions "Specifically, if block 0 contains an MBR with more than one partition entry, or a single partition entry whose OSType is not 0xEE, it is not a compliant GPT disk, and manipulating the GPT may cause dangerous inconsistencies between it and the legacy MBR."

and they follow that with a:

WARNING: Failure to comply with this recommendation may result in the loss of user data.

So there you have it... Apple's GPT support is completely laughable and confusing as hell. They completely violate their own recommendations not to mention the specs.

Ironically, I can use Apple's DiskUtility to format a Leopard Mac with good old MBR and 2 partitions. I can restore a Windows XP image (via RapiDeploy) and a Mac image (via netinstall) to these partitions, and THEY ARE BOTH BOOTABLE just FINE. The caveat is, you can only boot from EFI (holding the option key). Once you're in Mac OS or Windows, NONE of your disks appear in the startup disk preference pane (you can't even select the disk you are booted to). It's kinda sad when EFI is smarter than your proper OS...

Don't get me wrong; EFI and GPT are totally awesome technologies-- I just hope we can stick to the standards. This means Microsoft: Get on the ball and support EFI and GPT for Windows XP and Vista. And to Apple: Why don't you stick with MBR for dual-boot Macs? You only support 2 usable partitions anyway!

4 comments:

Anonymous said...

Can you answer tiny question? Can I install Windows with creating single partition? I really don’t need to boot Mac OS. Is there any issue to delete GPT partition?

brien said...

Yep, just use DiskUtil to create one partition, and change the partition type to MBR instead of the default.

Timo said...

What made my life a lot easier was the fact that Windows can use a 100 MB system partition to boot.

I took the following steps to create a dual boot system on my MacBook Pro - a system with an extra data partition and that can use Ghost backup software:

1) Boot OSX installer.

2) In the OSX installer, with Disk Utility, create the desired partitions (mine were empty space (to create Windows and Data partitions later) and Mac partition (OSX Journaled)).

At this point I chose MBR over GUID. (You can see these options when you select the actual drive, go to the partitions tab, and press some button there.) Whether this is ideal or not, it works fine with the process described here.

3) Install OSX (or restore it from Time Machine backup).

4) Boot from Windows 7 install DVD and choose custom/advanced setup.

5) When the partitions show, show the advanced drive options. Select the free space and create any new partitions that you require. NOTE: The first one you create will get a 100 MB system partition in front of it. This is the key step that took me days to realize. You can fill the space with any number of partitions. I created one for Windows and one for my Data. I ended up with: System (100 MB), Windows, Data, Mac (was already there).

6) Format the new partitions (will become NTFS), EXCEPT THE 100 MB SYSTEM PARTITION! (Made a mistake? Delete 'em and create 'em again. No hassle.)

7) Install Windows onto the desired partition. I suggest installing it onto the first one you created - the one that directly follows the small system partition.

After Windows finishes installing, boot your Mac while holding the alt (option) key. You should now be able to choose between your Mac and your Windows OS.

If you want to boot Windows by default, launch Windows. Install Apple's driver bundle (which you can create from the Boot Camp Assistant in OSX), reboot, and open the Boot Camp preferences in Windows (it's in your system tray). Here, Windows is actually recognized and you can set it as the default boot OS. One drawback: when you reboot from OSX, your machine will reboot in OSX. So when I need to boot from OSX to Windows, I simply hold the alt key again.

Let us all know if this has helped you out as well. It certainly was solved things for me after three full days of puzzling.

Cheers,
Timo

js2010 said...

Cool. Refit gptsync fixes the disk after using rapideploy on a mac.