3

My system is divided in two and shared using Boot Camp feature. Recently I needed more space on the Mac partition and whiled loaded only in the Windows partition, I have shrank my Windows partition by 10 Gb using Windows disk management tool.

Now I can no longer start up the Boot Camp bridge while in the Mac OS X side to access the Windows partition. I suspect the Boot Camp file no longer recognize this modified Windows partition.

Is there a quick to solve this issue without having to reinstall everything?

1
  • I suppose if the gpt now differs from the MBR table you may not be able to boot back to Windows. If your Mac is new enough to boot from the internet then you could just enter the gpt command from a terminal to correct the problem. Commented Apr 10, 2015 at 17:54

1 Answer 1

2

This error occurred because in a Boot Camp setup, your hard drive has a hybrid GPT/MBR partition table, which is unsupported by Microsoft. When you resized the partition in Windows, it only modified the MBR partition table because it was unaware that the GPT table existed. You now have a situation where the GPT partition table and the MBR partition table disagree about the start/end boundaries of the Windows partition.

To fix this, you will need to use the gpt command line tool, and for that you must boot from OS X install media (either a USB flash drive, or Internet Recovery if your model supports that feature -- the recovery partition will not work for this).

  1. Boot from OS X install media and open up a command prompt.
  2. Type fdisk /dev/disk0 to see the MBR partition table. Write down the partition number (it's usually 4), the start sector, and the size of the Windows partition. The start sector and size will be big numbers so make sure you write them down correctly. This is critical.
  3. Type diskutil unmountDisk /dev/disk0 This will unmount the disk so GPT can write to it.
  4. Type gpt remove -i 4 /dev/disk0 NOTE that the '4' here references the partition number of your Windows partition you got from fdisk earlier. This will delete the GPT partition entry for your Windows partition (but not the MBR entry)
  5. Type fdisk -d /dev/disk0 >/Volumes/fdisk.txt This will make a backup of the MBR partition table.
  6. Type fdisk -e /dev/disk0 This will put the fdisk command in interactive edit mode. You will need to enter the following input.
    NOTE that the '4' here references the partition number of your Windows partition you got from fdisk earlier. This will delete the MBR partition entry for your Windows partition.

    e 4
    0
    q
    y
    
  7. Type diskutil unmountDisk /dev/disk0 again because the gpt command caused OS X to remount the disk and we need to modify it again.
  8. Type gpt add -b <start sector> -s <size> -i 4 -t windows /dev/disk0 where 'start sector', 'size', and '4' are the values you wrote down from the fdisk command earlier.
  9. For good measure, type gpt show /dev/disk0 to view the GPT table. Make sure the partition number, start sector, and size match the fdisk output from step 2 EXACTLY.
  10. Type diskutil unmountDisk /dev/disk0 again because the gpt command caused OS X to remount the disk and we need to modify it again.
  11. Type fdisk -r -y /dev/disk0 </Volumes/fdisk.txt This will undo the changes made in step 6.
  12. For good measure, type fdisk /dev/disk0 to view the MBR table. Make sure the output matches the fdisk output from step 2 EXACTLY.

You have now repaired your GPT table. You should be able to reboot the Mac into either operating system now.

5
  • Thank you for editing that for me, @DavidAnderson. You took some work off my shoulders!
    – Wes Sayeed
    Commented Apr 22, 2015 at 19:29
  • hi, in this part it returns me error :" Type diskutil unmountDisk /dev/disk0 This will unmount the disk so GPT can write to it." unmount failed for dev/disk0 nad i use force command but its not working too . please help me i have same problem. :(
    – Arash
    Commented Dec 14, 2015 at 7:00
  • 1
    You must be booted from external media for this command to work. Either from a USB stick or Internet Recovery (i.e. Cmd+Opt+R). Booting to the recovery environment (Cmd+R) is not sufficient, as you will be booted from a partition of the disk you're trying to modify. You can't unmount the disk in that scenario.
    – Wes Sayeed
    Commented Dec 14, 2015 at 17:35
  • how i can boot from external USB? i try to boot from internet but i faced that problem again. @wesSayeed
    – Arash
    Commented Dec 15, 2015 at 5:26
  • This is really bad advice and will break your mac, you can lose the entire disk if ANYTHING goes wrong, I strongly advise you to not follow these steps.
    – jturolla
    Commented Feb 3, 2018 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .