Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
How to go back to hybrid-MBR?

Alot of progress! But, How do I switch the MBR back to the hybrid-style??

I used testdisk to manually restore the BOOTCAMP partition on the GPT. I also had to use gdisk to set the correct partition types and labels. BOOTCAMP partition now shows in mac's diskutil!!

However, testdisk took the MBR table from a hybrid-MBR to a protective-MBR (see here) Windows does not know how to read from GPT's or protective-MBR's :(

Code:
$ sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 60821/255/63 [977105060 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -  977105059] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Code:
$ sudo gpt -r -vv show /dev/rdisk0
Password:
gpt show: /dev/rdisk0: mediasize=500277790720; sectorsize=512; blocks=977105060
gpt show: /dev/rdisk0: PMBR at sector 0
gpt show: /dev/rdisk0: Pri GPT at sector 1
gpt show: /dev/rdisk0: Sec GPT at sector 977105059
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  822156848      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  822566488    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  823836024        648         
  823836672  153268217      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  977104889        138         
  977105027         32         Sec GPT table
  977105059          1         Sec GPT header
 
You can create a new hybrid MBR with gdisk as follows
Open gdisk with
sudo gdisk /dev/disk0

type "r" (no quotes) and press enter
type "h" and press enter

You'll get a warning that hybrid MBR's are flaky and dangerous. That's ok.

It will ask for 1 to 3 partition numbers (space separated) so enter
2 3 4 (one space between each) and press enter

It will ask if you want to include the EFI partition first in MBR
answer Y and enter

you will get default entries for partition 2 - accept them by pressing enter BUT
the last question will ask if you want to make the partition bootable - answer N and press enter.

Do the same for partition 3

For partition 4 accept defaults (checking that type 07 is the default option for partition type) but when it asks you if you want to make partition 4 bootable - answer Y and press enter.

When finished type "w" and press enter - to write changes to the partition table.

Answer Y to continue.

When done type "q" to quit gdisk
Close terminal

Reboot holding Alt key and see if Windows appears in the boot menu - try to boot it.
 
Last edited:
My solution

  1. Find and run a recovery OS on CD/USB
    • Parted Magic was what I used; $5; well worth it
    • free ones exist, though they may not be as well put together. Assure you can get command-line access to 'gdisk' and 'testdisk'
    • To run parted magic off of USB stick on mac:
      • Download Parted Magic .iso to desktop
      • hdiutil convert -format UDRW -o ~/Desktop/pmagic_2013_11_11.img ~/Desktop/pmagic_2013_11_11.iso
      • mv pmagic_2013_11_11.img.dmg pmagic_2013_11_11.img
      • Run 'diskutil list', insert USB stick, run it again and see which disk # it is
      • Run 'diskutil unmountDisk /dev/diskN' (replace N with the disk number from the last command)
      • sudo dd if=~/Desktop/pmagic_2013_11_11.img of=/dev/rdiskN bs=1m
      • more details on this can be found at http://forums.partedmagic.com/viewtopic.php?f=12&t=88#p562
      • diskutil eject /dev/diskN
    • restart your mac and press alt/option
    • choose the bootable recovery OS CD/USB from the boot options
  2. Learn the in's and out's of testdisk and gdisk
    • Do not operate these confusing utilities w/o first reading these doc pages 1 2 3
    • Just run as 'testdisk' and 'gdisk', no command line arguments. They both have extensive menu-based controls
    • /dev/sd* is ussually where most disks are (where * is a or b or c, etc)
  3. Backup your existing partition table
    • This is IMPORTANT. I accidentally overwrote my partition table with testdisk (didnt mean to at all). Luckily I loaded the former (partially working one) from backup files.
    • Can be done well with gdisk's 'b' option
    • Also testdisk allows it at some point, called [Backup]
    • It is advised to load these backup files immediately to somewhere offsite. I uploaded my files to my dropbox.com acct, which you can do in a browser
  4. Use testdisk to find the start/end points of your missing partition
    • testdisk, append, /dev/sda, EFI GPT, show current, Analyze, proceed with quick scan
    • quick scan showed me a list of prior partitions, and existing partitions; it is your job to figure out which are which
    • Mine was a former partition called [BOOTCAMP] that had start/end sectors that were very close to the blank segments that I saw in the current MBR
    • In other words, my existing incorrect partition table gave clues to where I had priorly expanded my bootcamp partition to. I used these educated guesses to see in testdisk which one was likely the missing partition
    • testdisk allows you to press 'p' to read the files from missing and found partitions
    • I would get a Segmentation Fault (complete program exited) when I tried to do this on my found [BOOTCAMP] partition. Dont let this get you down
    • When you are relatively confident of which partitition is the missing one, Write down the start/end sectors (I took a lot of pics with my smart phone)
  5. Create a new partition table
    • This can be done in either tool; I did it in testdisk, because it already had all the data from the various partitions and the lost partition; however, I did find that testdisk loses all kinds of other data on each partition (the partition type, the partitions name), so you will have to enter these later
    • After the above 'Analyze' operation inside of 'testdisk', you use the arrow keys up and down to select the various partitions
    • I actually hit 'L' to load the backup. This selects all of the current partitions
    • You can use Left and right arrows to select which partitions to use. I removed the old incorrect bootcamp and selected the lost correct [BOOTCAMP] partition
    • I had to manually go through and enter each of the partition types 'T' key; See list of partition codes here
    • Structure said OK
    • Hit 'W' to write the data
  6. Use gdisk to check your work
    • All of the partition types and file types need to be correct; use 07 for the lost microsoft partition, not 0C
    • Label the partitions to what they used to be called; testdisk had unlabeled them for me
  7. Create a Hybrid-MBR; http://www.rodsbooks.com/gdisk/hybrid.html
  8. Check that the partition shows in Mac 'Disk Utility' app
  9. Use windows recovery / install CD/USB to jump-start
    • At boot on mac, hit alt/option; For me, windows still was not showing
    • I booted up a windows install USB key
    • I tried to find a recovery option, but could not
    • I accidentally start the install on the same partition, saying that it would install the new windows next to the existing windows.
    • As soon as it started to install, maybe 5 seconds in, I restarted the computer, as I didnt want to reinstall windos.
    • This magically made windows appear on the alt/option boot screen!
 
Last edited:
Hi guys,

I too have had an unfortunate event with Mavericks, I had an installation with snow leopard and boot camp working perfect.

I saw Maverick and thought I would update it...

Everything ran smooth but then I was going to log in to my bootcamp... not working...

I entered disk utility showing disk0s4

sudo fdisk /dev/rdisk0

Disk: /dev/rdisk0 geometry: 60801/255/63 [976773168 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 - 180633776] HFS+
3: AB 1023 254 63 - 1023 254 63 [ 181043416 - 1269544] Darwin Boot
4: 0C 1023 254 63 - 1023 254 63 [ 182312960 - 794460160] Win95 FAT32L


sudo gpt -r -vv show /dev/rdisk0
gpt show: /dev/rdisk0: mediasize=500107862016; sectorsize=512; blocks=976773168
gpt show: /dev/rdisk0: Suspicious MBR at sector 0
gpt show: /dev/rdisk0: Pri GPT at sector 1
gpt show: /dev/rdisk0: Sec GPT at sector 976773167
start size
index contents
0 1
MBR
1 1
Pri GPT header
2 32
Pri GPT table
34 6
40 409600
1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 180633776
2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
181043416 1269544
3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
182312960 794460160
4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
976773120 15
976773135 32 Sec GPT table
976773167 1 Sec GPT header

I have no backup of this drive and would really need to get back in there... :)

Thanks you guys
 
skuggan, can you go back and edit your prior post to include those results within [ CODE ] [ / CODE ] brackets? They are very hard, if not impossible, to read. Spacing has been removed and its hard to tell which numbers belong to which column. Youll need to run the commands again, copy and paste back in. Thanks.

Secondarily, did you indeed resize your windows partition? At first glance, it doesnt look like you did to me.... but I could very well be wrong. Just verify that you did, and how you did it (in windows? what utility?)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.