Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
ok. cool.

I've used gdisk to add two new partitions:

Code:
Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 40B881F4-3BFF-4136-9E42-EBF5FE40FF95
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 409606 sectors (200.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1           409640       879505487   419.2 GiB   AF00  Customer
   2       879505488       921448527   20.0 GiB    8300  Linux filesystem
   3       921448528       976773134   26.4 GiB    0700  Microsoft basic data

I'll now try to get Ubuntu installed and see where it goes.

Thanks much for the help thus far, I'll be back after trying that.
 
Number Start (sector) End (sector) Size Code Name
1 409640 879505487 419.2 GiB AF00 Customer
2 879505488 921448527 20.0 GiB 8300 Linux filesystem
3 921448528 976773134 26.4 GiB 0700 Microsoft basic data

Hold on. Your EFI System partition isn't there anymore. Why? Are you ensuring that you use the w command to write out the partition table in gdisk before you quit?

EFI System partition needs to be present if Ubuntu has any hope of EFI booting. You should have four partitions.

----------

You can add partitions out of order, just add another one, 4, with the correct start (40) and end (409639) and partition type (EF00). When you use the p command, it will be partition 4. To make it partition 1, use the s command in gdisk to sort partitions.

You must use the w command before quitting gdisk. Or it won't write changes to the GPT.
 
no (w command).

good catch.

as I look now even the recently created ones had gone away.

headed back to fix that now...
 
much better:

Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1            409640       879505487   419.2 GiB   AF00  Customer
   2                      40          409639   200.0 MiB   EF00  
   3       879505488       921448527   20.0 GiB    8300  Linux filesystem
   4       921448528       976773134   26.4 GiB    0700  Microsoft basic data
 
much better:

Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1            409640       879505487   419.2 GiB   AF00  Customer
   2                      40          409639   200.0 MiB   EF00  
   3       879505488       921448527   20.0 GiB    8300  Linux filesystem
   4       921448528       976773134   26.4 GiB    0700  Microsoft basic data

If you haven't already installed Ubuntu I'd resort the entries with the s command then rewrite out the GPT. I don't think there's a negative consequence to the EFI partition being 2nd, the spec doesn't say it has to be first, but....
 
ok, did that (s command, then w, then reboot) and thus:

Code:
Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 40B881F4-3BFF-4136-9E42-EBF5FE40FF95
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       879505487   419.2 GiB   AF00  Customer
   3       879505488       921448527   20.0 GiB    8300  Linux filesystem
   4       921448528       976773134   26.4 GiB    0700  Microsoft basic data

I had tried to install Ubuntu between last night and seeing your message this morning regarding the s command, but I couldn't get the machine to recognize either the USB or DVD drive that have the Ubuntu images on them (using either the [C] key to boot the the DVD or the [alt/option] key to boot to the USB).

Perhaps that was hanging up due to the order of the partitions?

In any case, I'll be back to trying to install Ubuntu this morning.
 
Once you're in the Ubuntu installation territory on a Mac, you'll likely get more help in Ubuntu Mac forums. What computer model is this again? And are you using x86_64 Ubuntu or i686?
 
I was able to get Ubuntu installed, and I now see this from within OSX:

Code:
diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            450.1 GB   disk0s2
   3: 21686148-6449-6E6F-744E-65656445                         1.0 MB     disk0s3
   4:       Microsoft Basic Data                         28.3 GB    disk0s4
   5:       Microsoft Basic Data                         17.3 GB    disk0s5
   6:                 Linux Swap                         4.2 GB     disk0s6

As I understand it, disk0s3 above is the one for GRUB, disk0s5 and disk0s6 are now for Ubuntu, and disk0s4 is left over for Windows to be installed last. anything wonky about that (the order seems odd)?

In any case, as it stands:

(a) OSX is still working fine and is the only option shown in rEFInd.

(b) Ubuntu is working but only available via [alt/option] and selecting the Windows partition, which then goes to GRUB, when then lets me access Ubuntu - which works fine when accessed that way.

I suspect what's next is to do what you wrote earlier:

As soon as you need more than four partitions, gptsync built into both rEFIt and rEFInd will not create the proper hybrid MBR. You'll have to create it manually with gdisk. My recommendation is that you stuff all GPT partitions except Windows into the MBR partition 1, protective MBR, code 0xEE. And then put the last GPT partition, Windows, in MBR partition 2 with the boot flag enabled. Basically this will tell any MBR only aware application that all of your non-Windows partitions are reserved for GPT usage, exposing only the Windows partition. Boot Camp Assistant almost certainly won't like it, but it's not designed for triple booting anyway so you shouldn't plan on ever using it.

Is that basically it:

* stuff all GPT partitions except Windows/disk0s4 into MBR partition 1, protective MBR, code 0xEE

* then put Windows/disk0s4 into MBR partition 2 with the boot flag enabled

* then install Windows onto disk0s4

??

Seems so. Any tips regarding all the MBR stuffing with gdisk would be great.

Thanks.
 
I was able to get Ubuntu installed

What do you get for:
Code:
sudo gdisk -l /dev/disk0


As I understand it, disk0s3 above is the one for GRUB, disk0s5 and disk0s6 are now for Ubuntu, and disk0s4 is left over for Windows to be installed last. anything wonky about that (the order seems odd)?

disk0s3 is for GRUB2's core.img, yes. That's fine. I'm not familiar with the Ubuntu installer, using Fedora and RHEL myself (which use anaconda as the installer), but it seems like it left slice 4 for windows, and added slices 5 and 6 for Linux, which is annoying to say the least. Instead it should have split up the partition created for it, and left the last one for Windows as the last partition. This is really ideal in order to get all GPT partitions stuffed into the MBR's protective entry, exposing only the last GPT partition which would be for Windows.

There really isn't a good way to protect non-contiguous portions of a disk.

(b) Ubuntu is working but only available via [alt/option] and selecting the Windows partition, which then goes to GRUB, when then lets me access Ubuntu - which works fine when accessed that way.

This tells me that Ubuntu is booting CSM-BIOS. Not EFI. FYI. Since Windows is also CSM-BIOS, and BIOS booting depends on a bootloader found in the first 440 bytes of sector 0, you can only have one boot loader for both Windows and Ubuntu. GRUB2 can do this. But when you install Windows, it will overwrite GRUB2's boot.img in the MBR. So that will have to be repaired later.
 
What do you get for:
Code:
sudo gdisk -l /dev/disk0

Code:
sudo gdisk -l /dev/disk0
Password:
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 40B881F4-3BFF-4136-9E42-EBF5FE40FF95
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       879505487   419.2 GiB   AF00  Customer
   3       879505488       879507441   977.0 KiB   EF02  
   4       921448528       976773134   26.4 GiB    0700  Microsoft basic data
   5       879507442       913239863   16.1 GiB    0700  
   6       913239864       921448527   3.9 GiB     8200

it seems like it left slice 4 for windows, and added slices 5 and 6 for Linux, which is annoying to say the least. Instead it should have split up the partition created for it, and left the last one for Windows as the last partition. This is really ideal in order to get all GPT partitions stuffed into the MBR's protective entry, exposing only the last GPT partition which would be for Windows.

There really isn't a good way to protect non-contiguous portions of a disk.

...Ubuntu is booting CSM-BIOS. Not EFI. FYI. Since Windows is also CSM-BIOS, and BIOS booting depends on a bootloader found in the first 440 bytes of sector 0, you can only have one boot loader for both Windows and Ubuntu. GRUB2 can do this. But when you install Windows, it will overwrite GRUB2's boot.img in the MBR. So that will have to be repaired later.

Though it would be a bit laborious - it seems like (given what you're saying) I should maybe use gdksk to move them around (by deleting 4, 5, and 6 and recreating them so that it's in the right order - effectively ...3,5,6,4 with the Ubuntu ones together and the Windows one last), then reinstall Ubuntu once they're in the right order (getting back "here")? Think that will work?

Ultimately I'd prefer one boot menu (rEFInd) with access to all three OSs, and it sounds like you're saying (given its current state) that I'd be left with rEFInd only showing OSX and having to access GRUB via [alt/option) from which I could access Ubuntu and Windows? or, is it the case that irrespective of whether or not the partitions are re-ordered - I'll ultimately still be able to access all three OSs from rEFInd somehow after modifying the MBR - it's just that MBR 1 won't be Protected? (as is likely clear, this is just at the edge of my understanding...)

I'm going to owe you a [insert favorite poison] after this.
 
Code:
   4       921448528       976773134   26.4 GiB    0700  Microsoft basic data
   5       879507442       913239863   16.1 GiB    0700  
   6       913239864       921448527   3.9 GiB     8200

Note the start sectors. The 4th partition is actually last. You can use gdisk to resort if you want, but I'm not totally sure if that's necessary. If you go through the gdisk menu, you'll find an recovery & transformation menu. In that menu is an option to create a new hybrid MBR. You'll add partitions 1 2 3 5 6 if you choose to not resort first; or 1 2 3 4 5 if you do. If you resort, you can go to the hybrid menu immediately after, without writing out the newly sorted GPT - gdisk will use the resorted table to create the hybrid MBR.

Next step in creating the hybrid MBR, you'll be asked if the GPT should be stuffed in the MBR, say yes.

For the remaining partition you'll be asked what code, accept default, and if it should be flagged bootable, say yes. Then write out the new partition.

Confirm this with:
Code:
sudo gdisk -l /dev/disk0
sudo fdisk /dev/disk0
 
Last edited:
Though it would be a bit laborious - it seems like (given what you're saying) I should maybe use gdksk to move them around (by deleting 4, 5, and 6 and recreating them so that it's in the right order - effectively ...3,5,6,4 with the Ubuntu ones together and the Windows one last), then reinstall Ubuntu once they're in the right order (getting back "here")? Think that will work?

Don't delete anything.


Ultimately I'd prefer one boot menu (rEFInd) with access to all three OSs, and it sounds like you're saying (given its current state) that I'd be left with rEFInd only showing OSX and having to access GRUB via [alt/option) from which I could access Ubuntu and Windows?

I don't use rEFInd so I'm not sure if it will find and use the 2nd stage Windows bootloader. If so, then it'll skip going through GRUB2 when you choose (the real) Windows. And it'll load GRUB2 if you choose Linux.

What I tolerated was just using the option key boot menu: choosing the Mac HD boots Mac OS; choosing Windows gives me GRUB2 and from that menu I choose Linux or Windows.

or, is it the case that irrespective of whether or not the partitions are re-ordered - I'll ultimately still be able to access all three OSs from rEFInd somehow after modifying the MBR - it's just that MBR 1 won't be Protected? (as is likely clear, this is just at the edge of my understanding...)

Apple's method of hybrid MBRs is a 1:1 correlation between GPT and MBR. The problem is that MBR supports a max of four entries. So with triple booting, you can't use Apple's method. So what I do is stuff all GPT entries that are not related to Windows, into MBR 1 as a protective entry that any MBR aware application should not touch. So MBR 1 = multiple GPT entries. And MBR 2 is the Windows partition, in your case GPT entry 4 or 6 depending on whether you resort.

The CSM-BIOS is pretty dumb. All it needs is a second MBR entry that is also flagged bootable, and then it will blindly execute the code in the first 440 bytes of the MBR. If that's GRUB, you'll get a menu for Linux and Windows to choose from.

If you use rEFInd, it does things differently and I can't tell you how it will behave. I used to use rEFIt, the precursor, but gave up because I found it way too confusing what was going on. I know rEFInd's code is cleaned up in this regard, but since I haven't used it, I can't describe how it will behave.
 
ok.

Code:
sudo gdisk -l /dev/disk0
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 40B881F4-3BFF-4136-9E42-EBF5FE40FF95
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       879505487   419.2 GiB   AF00  Customer
   3       879505488       879507441   977.0 KiB   EF02  
   4       879507442       913239863   16.1 GiB    0700  
   5       913239864       921448527   3.9 GiB     8200  
   6       921448528       976773134   26.4 GiB    0700  Microsoft basic data

and

Code:
sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 -    0   0  40 [         1 -         39] <Unknown ID>
*2: EF    0   0  41 -   25 127  14 [        40 -     409600] <Unknown ID>
*3: AF   25 127  15 - 1023 254  63 [    409640 -  879095848] HFS+        
*4: EF 1023 254  63 - 1023 254  63 [ 879505488 -       1954] <Unknown ID>
 
Oops, I gave the wrong instructions for the hybrid MBR. Do over.

Go back to the recovery menu, create a new hybrid MBR, and add just partition 6. Yes to add GPT to MBR. Default code for partition 6, and flag it as bootable.

And then to confirm:
Code:
sudo fdisk /dev/disk0


----------

And when gdisk says there's unused entries in the MBR, do you want to add more entries, say no.
 
What you're looking for is entry 1 should have ID EE. And entry 2 should have an asterisk and ID 07. And entries 3 and 4 are blank. Then you're ready to install Windows, don't forget to format that partition as NTFS.

Don't let Boot Camp Assistant touch the disk. Don't ever let a Windows utility resize any volume, including its own NTFS volume. If you do, good chance the whole enchilada will be fakaked beyond salvation.
 
ok, I did the re-do - which seemed to have gone well, but now I'm getting an error before GRUB even shows a menu when trying to load Ubuntu via [alt/option] and the "Windows" option:

Code:
error: unknown filesystem
grub rescue >

beyond that all seems normal-ish, and osx still works.

What you're looking for is entry 1 should have ID EE. And entry 2 should have an asterisk and ID 07. And entries 3 and 4 are blank. Then you're ready to install Windows, don't forget to format that partition as NTFS.

that's what it shows.
here are the current outputs from fdisk and gdisk:

Code:
sudo fdisk /dev/disk0
Password:
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -  921448527] <Unknown ID>
*2: 07 1023 254  63 - 1023 254  63 [ 921448528 -   55324607] HPFS/QNX/AUX
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Code:
sudo gdisk -l /dev/disk0
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 40B881F4-3BFF-4136-9E42-EBF5FE40FF95
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       879505487   419.2 GiB   AF00  Customer
   3       879505488       879507441   977.0 KiB   EF02  
   4       879507442       913239863   16.1 GiB    0700  
   5       913239864       921448527   3.9 GiB     8200  
   6       921448528       976773134   26.4 GiB    0700  Microsoft basic data
 
Code:
error: unknown filesystem
grub rescue >

GRUB isn't finding /boot/grub possibly because it was hardcoded to look in a particular partition rather than by UUID - which would be a bit weird as GRUB2 I thought had gone entirely to UUIDs. Anyway, there are myriad ways to deal with this: you could try your hand at the grub rescue command line to find the partition with /boot/grub and get linux to boot, and then rerun update-grub so that the grub.cfg is rewritten with new information. Or you can use a GRUB2 rescue disk of choice. Or use a LiveCD and fix it from there if you know how to mount /, /boot, and proc sys dev filesystems and chroot it, then use update-grub. Or you can use an install CD in rescue mode (I'm not familiar with Ubuntu but Fedora install media, if you use the rescue kernel parameter at boot, will automatically find, mount, and chroot your linux file system, then all you have to do is update-grub (which btw is a unique Ubuntu command, everything else uses grub-mkconfig -o <location of cfg>). I think the last option is the easiest if Ubuntu has a rescue boot option.

Code:
 1: EE    0   0   2 - 1023 254  63 [         1 -  921448527] <Unknown ID>
*2: 07 1023 254  63 - 1023 254  63 [ 921448528 -   55324607] HPFS/QNX/AUX
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Looks good.

Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  
   2          409640       879505487   419.2 GiB   AF00  Customer
   3       879505488       879507441   977.0 KiB   EF02  
   4       879507442       913239863   16.1 GiB    0700  
   5       913239864       921448527   3.9 GiB     8200  
   6       921448528       976773134   26.4 GiB    0700  Microsoft basic data

Yep.

----------

Install Windows 7 first. Then fix GRUB.
 
When you install Windows 7, it will step on the stage 1 (boot.img) portion of GRUB in the first 440 bytes of the disk. So just get Windows installed for starters.

To fix GRUB2, basically what I said. I'd use an Ubuntu disk with rescue mode boot, hopefully it has such an option. And you'll need to do two things. Install GRUB to the disk. And create a new grub.cfg. Installing GRUB for a chrooted volume is something like:

Code:
grub-install --recheck /dev/sda

And recreating the grub.cfg is either update-grub or:

Code:
grub-mkconfig -o /boot/grub/grub.cfg


----------

FWIW, grub-install will replace the first 440 bytes with boot.img, wiping out the Windows first stage boot loader. And will replace core.img in that 1MB BIOS Boot partition. But will not update grub.cfg.

The updating of grub.cfg will cause a series of scripts to run that will find Ubuntu and Windows and Mac OS X, and create boot entries for all of them. So you have to do all of this or it ain't gonna work because the current grub.cfg is predicated on a system that doesn't yet have Windows on it, so the menu won't show Windows. (Unfortunately it's not a dynamically created menu, despite the year being 2012.)
 
MBR and GPT are two different partitioning methods. APM is a third. MBR pre-dates GPT. The UEFI spec defines the GPT, and suggests that LBA 0 (the first sector of a drive) contain a protective MBR, which is an MBR with a single partition entry, type 0xEE, covering all sectors from LBA 1 (the start of the GPT) to the (second to) last LBA. The UEFI spec also distinguishes between such a protective MBR and a legacy MBR which is one that doesn't contain an 0xEE entry.



The GPT of such a disk contains three entries: EFI, Mac OS, Recovery HD. Before Bootcamp, the MBR contains one 0xEE entry for the whole disk. After Bootcamp, the MBR contains entries in all four locations: an adjusted 0xEE for blocks that contain the primary GPT itself, and EFI partition; an entry 0xAF for Mac OS, an entry 0xAB for Recovery HD, and entry 0x07 for Windows.

It's much easier to visualize this if you use GPT fdisk, from Source Forge, also knowns as gdisk to view the actual GPT entries. And the included fdisk from Apple to view the MBR.




The original reference is misleading in that you don't really have two independent partition tables, by default. You have just one, GPT. Which comes with a recommended protective MBR, which is an MBR that has a single protective entry, type code 0xEE, spanning the whole disk. This is just to protect the primary GPT and the contents of the disk from legacy OS's and apps that don't know what GPT is. That's it. It's not an independent partition table.

Disk Utility doesn't have a way for you to add any partitions to a disk, you have to re-partition from scratch. When you do this, that disk gets a whole new GPT with however many partitions you define (plus a hidden EFI System partition), and a protective MBR with a *SINGLE* 0xEE entry.

In the case of Boot Camp, first it resizes an existing JHFS+/X volume, adjust the entry in the GPT, creates a new GPT entry for the freed up space (for Windows), formats it FAT32, and then creates a hybrid MBR which contains a resized 0xEE entry for just the blocks containing the primary GPT and EFI System partitions. And separate entries for Mac OS, Recovery HD, and Windows.

If you were to use command line tools to resize that JHFS+ partition yet again, you'd have one messed up disk because it will not update the hybrid MBR. Just the GPT.

Here is a good time to point out that hybrid MBRs are flakey, dangerous, non-standard, and depart from the UEFI spec considerably. They even depart from Apple's own technote on this, yet they use them. I'm not a fan, but this is consequence of not having UEFI 2.x firmware on Apple hardware, which is the minimum required for a Windows 7 x86_64 UEFI installation, instead of a BIOS based installation. Windows BIOS installs only use MBR for boot disks. And Windows UEFI installs only use GPT for boot disks. Since we don't have UEFI 2.x firmware, but Apple and Intel did include a CSM-BIOS with most Apple hardware - we're in this hybrid MBR business.





Not really. That protective MBR is just a place holder to protect the data on the disk from legacy MBR only tools and operating systems that do not understand GPT.




It's confusing, I admit it. A protective MBR as defined in the UEFI spec is an MBR that contains a single protective 0xEE partition entry. That's it.

A hybrid MBR is not defined anywhere. It is an MBR that contains one protective 0xEE entry: it is protecting the blocks for the primary GPT and the EFI System partition; and it contains one or more additional entries.

Further, there is NO requirement that the MBR entries at all match up with GPT entries. In order for me to triple boot Apple hardware, I generate my own hybrid MBR using gdisk. I have a GPT with 8 entries, depending on which OS's are installed and how they're configured. I will generally make Windows the very last GPT entry. The MBR 1st partition is defined for the blocks making up *all* of the GPT first 7 partitions, with type code 0xEE, and the MBR 2nd partition defines the blocks identical to the GPT's 8th partition entry for Windows. So in the MBR, I'm only exposing the Windows blocks. I mark that bootable, because that's what Apple's EFI implementation needs to activate the CSM-BIOS to find and run the bootloader code in the first 440 bytes of the MBR.

It all gets VERY confusing because different hardware treats hybrid (non-standard!) MBRs differently.




Umm, definitely not. As soon as the 0xEE entry is missing from an MBR, it is no longer a protective or hybrid MBR. It is a valid legacy MBR and the UEFI spec language fully supports treating such a disk entirely an only as an MBR disk, and the GPT is to be ignored.

And think of the reason why. When you use a legacy tool for partitioning a disk, like fdisk, that has no idea what a GPT is, what's it going to modify? Only LBA 0. It will only alter the MBR. It has no way of blanking out the primary or backup GPT, which means they will be left intact.

The only way to resolve this ambiguity fairly is to treat a disk that has a valid legacy MBR (no 0xEE entry) as strictly MBR.

Remember, the 0xEE entry starts at LBA 1. LBA 1 is the primary GPT header, and subsequent sectors contain the GPT entries themselves. If they are not protected by an MBR partition entry of 0xEE, then those sectors are NOT allocated as far as MBR aware applications/systems are and are fair game for being overwritten.
Hi there!

Read the whole subject here,but didn't quite understand it. I ve got the same doubts fo WHY we need hybrid on apple computer. Well, if apple provided efi with csm, windows wouldn't need the hybrid
MBR and GPT are two different partitioning methods. APM is a third. MBR pre-dates GPT. The UEFI spec defines the GPT, and suggests that LBA 0 (the first sector of a drive) contain a protective MBR, which is an MBR with a single partition entry, type 0xEE, covering all sectors from LBA 1 (the start of the GPT) to the (second to) last LBA. The UEFI spec also distinguishes between such a protective MBR and a legacy MBR which is one that doesn't contain an 0xEE entry.



The GPT of such a disk contains three entries: EFI, Mac OS, Recovery HD. Before Bootcamp, the MBR contains one 0xEE entry for the whole disk. After Bootcamp, the MBR contains entries in all four locations: an adjusted 0xEE for blocks that contain the primary GPT itself, and EFI partition; an entry 0xAF for Mac OS, an entry 0xAB for Recovery HD, and entry 0x07 for Windows.

It's much easier to visualize this if you use GPT fdisk, from Source Forge, also knowns as gdisk to view the actual GPT entries. And the included fdisk from Apple to view the MBR.




The original reference is misleading in that you don't really have two independent partition tables, by default. You have just one, GPT. Which comes with a recommended protective MBR, which is an MBR that has a single protective entry, type code 0xEE, spanning the whole disk. This is just to protect the primary GPT and the contents of the disk from legacy OS's and apps that don't know what GPT is. That's it. It's not an independent partition table.

Disk Utility doesn't have a way for you to add any partitions to a disk, you have to re-partition from scratch. When you do this, that disk gets a whole new GPT with however many partitions you define (plus a hidden EFI System partition), and a protective MBR with a *SINGLE* 0xEE entry.

In the case of Boot Camp, first it resizes an existing JHFS+/X volume, adjust the entry in the GPT, creates a new GPT entry for the freed up space (for Windows), formats it FAT32, and then creates a hybrid MBR which contains a resized 0xEE entry for just the blocks containing the primary GPT and EFI System partitions. And separate entries for Mac OS, Recovery HD, and Windows.

If you were to use command line tools to resize that JHFS+ partition yet again, you'd have one messed up disk because it will not update the hybrid MBR. Just the GPT.

Here is a good time to point out that hybrid MBRs are flakey, dangerous, non-standard, and depart from the UEFI spec considerably. They even depart from Apple's own technote on this, yet they use them. I'm not a fan, but this is consequence of not having UEFI 2.x firmware on Apple hardware, which is the minimum required for a Windows 7 x86_64 UEFI installation, instead of a BIOS based installation. Windows BIOS installs only use MBR for boot disks. And Windows UEFI installs only use GPT for boot disks. Since we don't have UEFI 2.x firmware, but Apple and Intel did include a CSM-BIOS with most Apple hardware - we're in this hybrid MBR business.





Not really. That protective MBR is just a place holder to protect the data on the disk from legacy MBR only tools and operating systems that do not understand GPT.




It's confusing, I admit it. A protective MBR as defined in the UEFI spec is an MBR that contains a single protective 0xEE partition entry. That's it.

A hybrid MBR is not defined anywhere. It is an MBR that contains one protective 0xEE entry: it is protecting the blocks for the primary GPT and the EFI System partition; and it contains one or more additional entries.

Further, there is NO requirement that the MBR entries at all match up with GPT entries. In order for me to triple boot Apple hardware, I generate my own hybrid MBR using gdisk. I have a GPT with 8 entries, depending on which OS's are installed and how they're configured. I will generally make Windows the very last GPT entry. The MBR 1st partition is defined for the blocks making up *all* of the GPT first 7 partitions, with type code 0xEE, and the MBR 2nd partition defines the blocks identical to the GPT's 8th partition entry for Windows. So in the MBR, I'm only exposing the Windows blocks. I mark that bootable, because that's what Apple's EFI implementation needs to activate the CSM-BIOS to find and run the bootloader code in the first 440 bytes of the MBR.

It all gets VERY confusing because different hardware treats hybrid (non-standard!) MBRs differently.




Umm, definitely not. As soon as the 0xEE entry is missing from an MBR, it is no longer a protective or hybrid MBR. It is a valid legacy MBR and the UEFI spec language fully supports treating such a disk entirely an only as an MBR disk, and the GPT is to be ignored.

And think of the reason why. When you use a legacy tool for partitioning a disk, like fdisk, that has no idea what a GPT is, what's it going to modify? Only LBA 0. It will only alter the MBR. It has no way of blanking out the primary or backup GPT, which means they will be left intact.

The only way to resolve this ambiguity fairly is to treat a disk that has a valid legacy MBR (no 0xEE entry) as strictly MBR.

Remember, the 0xEE entry starts at LBA 1. LBA 1 is the primary GPT header, and subsequent sectors contain the GPT entries themselves. If they are not protected by an MBR partition entry of 0xEE, then those sectors are NOT allocated as far as MBR aware applications/systems are and are fair game for being overwritten.
Read the whole subject here. I stiil have the same doubts about it. If apple provided uefi with csm, why would we need hybrid mbr partitioning for installing a win7 x64 system? Because win7 x64 can be installed on gpt disks, right?

I got similar problems when installing win 7 on older 21,5 2010 imac here (dual booting). Previously,i installed high sierra, whch i assume has flashed the firmware to a non csm compatible (i think,i font know anymore because i cannot find out if the firmware flashed by high sierra is csm. The programs show only EFI, no description about being csm)

I didnt' quite get the apple firmware 2,x... you mean 2,x and futher would not have csm or would them?

Thank you for your knowledge!

Regards.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.