Symptom: You use Bootcamp to dual-boot OSX and Windows. After installing Windows, you are not able to see the BOOTCAMP partition in OSX. If you try viewing the disk using disk utility, the BOOTCAMP partition is greyed out, and shows up as FAT formatted although it is NTFS formatted.

Turns out the issue occurs because of a modification during Windows installation. Once Bootcamp Assistant (BCA) created the BOOTCAMP partition and restarted the system, I noticed that there was an additional small-sized partition created (~600MB) just before the BOOTCAMP partition. Instead of ignoring it, I deleted and recreated the bootcamp partition from Windows setup hoping the wasted space would be reclaimed. That was a bad idea.

When you do this, it confuses the hybrid GPT/MBR partitioning scheme used by BCA. Essentially, when you remove/resize/add partitions via Windows setup, that information gets updated in the MBR record, but is not synced to the GPT record. Thus, Windows will see the OSX partition, but not vice-versa.

The easy way to fix this without going through the pain of removing and reinstalling Windows from scratch is to sync the MBR info back to the GPT record. Here’s how to do it:

First, we need detailed information on the MBR record—where the partition starts, where it ends etc. For this purpose, use the gptsync tool. Homebrew has the gptsync package, but if you try to use it, you’ll end up with the following error:

    Warning: Unknown GPT spec revision 0x00010000 

This is because of 64-bit incompatability. A fixed version of gptsync aimed at OSX, extracted from rEFIt is available here. Just compile it using Xcode, and you’re good to go.

Running gptsync on my machine resulted in the following:

    > ./gptsync /dev/disk0
    Current GPT partition table:
     #      Start LBA      End LBA  Type
     1             40       409639  EFI System (FAT)
     2         409640    250801735  Mac OS X HFS+
     3      250801736    252071271  Mac OS X Boot
     4      252071936    500117503  Basic Data

    Current MBR partition table:
     # A    Start LBA      End LBA  Type
     1              1       409639  ee  EFI Protective
     2         409640    250801735  af  Mac OS X HFS+
     3 *    250802176    251518975  07  NTFS/HPFS
     4      251518976    500115455  07  NTFS/HPFS   

In the scenario above, the solution was to modify the GPT table to match the MBR table. Essentially, delete partitions 3 and 4, and then recreate it as per MBR. For this purpose, I used the gdisk tool available here. Once installed, run the tool (usage instructions are similar to fdisk, tutorial is available on the tool’s website). I used d command to delete partitions 3 and 4, n command to recreate them with first sector and last sector noted from MBR and type 0700. Once done, check the changes using command p, and verify for errors using v. If there are no errors, confirm the changes by writing them with command w, reboot and enjoy!