Comment 12 for bug 757201

Revision history for this message
Rod Smith (rodsmith) wrote :

I'm the author of GPT fdisk (gdisk, sgdisk). Some comments:

* There's no such thing as a "fake protective partition." The 0xEE partition in the MBR does not correspond to any real partition in the GPT. The purpose of the 0xEE partition is to keep GPT-unaware utilities from messing with the disk. It ordinarily covers the space from sector 1 to the end of the disk, but on a hybrid disk this is reduced to the space from sector 1 to one less than the first sector of the first (in disk space terms) GPT partition included in the hybrid MBR. Note in particular that the 0xEE partition does NOT correspond to the EFI System Partition (ESP), although at first glance it might look like it does. (The belief that these two partitions are equivalent can cause problems if a user attempts to access the 0xEE partition from Windows. If writes are attempted, the result can be damage to the GPT data structures!)

* IMHO, routinely creating a hybrid MBR is a Bad Idea (note the i-caps). See my Web page on hybrid MBRs (http://www.rodsbooks.com/gdisk/hybrid.html) for an extended discussion of this, but in brief, they're ugly and dangerous -- it's too easy for either an MBR partitioning tool or a GPT partitioning tool to get the two to be out of sync in one way or another, which can have disastrous results. Unfortunately, Apple chose to rely on hybrid MBRs to get Windows booting on Macs, so we're left dealing with their mess. In an ideal world, Linux could boot on Macs using EFI mode, obviating the need for a hybrid MBR on Linux/MacOS dual-boot systems, but this remains a bit tricky. As to rules for when to create a hybrid MBR automatically, that's even trickier, but I'd start with doing it ONLY on Macs or on BIOS-based systems that already have one. On UEFI-based PCs, a hybrid MBR should never be necessary (since Windows boots fine in UEFI mode from GPT on such systems). On a BIOS-based PC, a hybrid MBR might be necessary to get Windows booting (as in a Hackintosh configuration), but Linux doesn't need it, so there's no point in creating one if it doesn't already exist. I haven't looked at the code in question so I don't know how hard it would be to add such rules to it, but blindly creating hybrid MBRs when they aren't necessary is a recipe for trouble.

* I wouldn't worry about keeping GPT and MBR partition numbers in sync. I don't know of any OS or utility that cares about this detail, and as I wrote earlier, the MBR's 0xEE partition isn't in sync with anything on the GPT side to begin with.

* I agree with Dave that there's no point in including a BIOS Boot Partition or Linux swap partition in a hybrid MBR. I'd go further: there's little point in including ANY Linux or OS X partition in a hybrid MBR; neither Linux nor OS X uses the hybrid MBR at all, and GRUB reads the GPT data just fine. I know of only two reasons to include such a partition: To kick Apple's EFI into BIOS compatibility mode to enable booting Linux in that way; and to enable Windows to access a Linux or OS X partition when appropriate drivers are installed. Given all the other variables at work, IMHO it's best to err on the side of not including these partitions in the hybrid MBR (and thus converting it into a conventional protective MBR if there are only Linux, OS X, and ESP partitions). Natty has greatly improved EFI support, and is likely to work with most Intel-based Macs in EFI mode; and if a user needs to access a Linux or Mac OS partition from Windows, that user can manually configure a hybrid MBR as required. Creating hybrid MBR partitions unnecessarily, OTOH, runs the risk of those partitions getting out of sync and causing data loss, which is a much more serious problem than needing to run gptsync or gdisk to create a hybrid MBR or add partitions to it.

I'll add this: When I first learned about hybrid MBRs a couple of years ago, I thought they were a useful and clever way around Microsoft's short-sightedness at not properly supporting GPT. As time has gone on and I've discovered all the subtle ways they can go wrong, though, my opinion has slowly changed. I now believe that whoever invented hybrid MBRs was quite irresponsible. (They're a clear violation of the GPT specification, by the way.) They're a real mess, and there are forum posts on ubuntuforums.org and elsewhere that illustrate the problems they cause in the real world. Please err on the side of doing LESS with them -- enter as few partitions into the hybrid MBR as possible, and ideally none (making the MBR a legal protective MBR).