Marcus Müller a.k.a. "Tethpub ZNeK"
crack-admin/coderâ„¢

GPT and MBR/PMBR

16.01.2012

I tried to install Windows 8 Developer Preview (x64) on my Macbook Pro 2010. It turns out Win8 refuses to install on a MBR partitioned drive on an EFI system. All my drives are GPT partitioned, so I wondered what went wrong. It turns out, Win8 is correct about the MBR not being a protective MBR (PMBR):

znek@zoidberg:(~)$ sudo gpt -r show -l /dev/rdisk0 gpt show: /dev/rdisk0: Suspicious MBR at sector 0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - "EFI System Partition" 409640 499446368 2 GPT part - "nZoidberg" 499856008 262151 500118159 32 Sec GPT table 500118191 1 Sec GPT header znek@zoidberg:(~)$ sudo fdisk /dev/rdisk0 Disk: /dev/rdisk0 geometry: 31130/255/63 [500118192 sectors] Signature: 0xAA55 Starting Ending #: id cyl hd sec - cyl hd sec [ start - size] ------------------------------------------------------------------------ 1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID> *2: AF 1023 254 63 - 1023 254 63 [ 409640 - 499446368] HFS+ 3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused 4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

If you need to recover the PMBR, you can either modify the MBR partition table to have only the first entry and cover the entire disk or create a blank GPT partitioned disk image with Disk Utility and grab its vanilla PMBR doing this:

znek@zoidberg:(~)$ sudo dd if=/dev/rdisk1 of=pmbr.bin bs=512 count=1

In order to write to /dev/rdisk0, you'll have to unmount all its filesystems… which is problematic, if that's your boot drive (you'll have to boot from another drive then). If /dev/rdisk0 isn't busy anymore, then putting the PMBR in place is trivial:

znek@zoidberg:(~)$ sudo dd if=pmbr.bin of=/dev/rdisk0 bs=512 count=1

Now, gpt won't complain about a suspicious MBR any longer and properly identify the MBR as being a PMBR:

znek@zoidberg:(~)$ sudo gpt -r show -l /dev/rdisk0 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table …