MacOS – Increasing Mac partition after shrink Windows Bootcamp partition

boot-campmacospartitioning

I have a Mid 2010 Macbook Pro running Mac OS X 10.9.4 with a 500GB HD.

The HD is partitioned with 370 GB to Mac and 128 GB to Windows and I decided to shrink the Windows partition to 65 GB because I needed more space on Mac, and I barely use Windows.

I resized the Windows Partition using Mini Tool Partition Wizard and moved it to the end of the disk, leaving the empty right after Mac partition.

I'm able to boot Windows partition and use it normally. The Windows C: disk now has 65 GB.

When I boot on Mac OS X and try to use disk utility to increase the Mac partition, it says that the Windows partition still has 128 GB.

It is possible to use the empty space I created?

Here's some information about my partitions:

$ sudo gpt -r -vv show disk0
gpt show: disk0: mediasize=500107862016; sectorsize=512; blocks=976773168
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: disk0: 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  723603632      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  724013272    1269544      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  725282816  251490304      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  976773120         15        
  976773135         32         Sec GPT table
  976773167          1         Sec GPT header

$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 0.8.10

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E34EA0BB-B94A-4854-AF05-02E0D06A48E5
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 21 sectors (10.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       724013271   345.0 GiB   AF00  Macbook HD
   3       724013272       725282815   619.9 MiB   AB00  Recovery HD
   4       725282816       976773119   119.9 GiB   0700  BOOTCAMP


$ 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 1023 254  63 - 1023 254  63 [         1 -     409639] <Unknown ID>
2: AF 1023 254  63 - 1023 254  63 [    409640 -  723603632] HFS+       
3: AB 1023 254  63 - 1023 254  63 [ 724013272 -    1269544] Darwin Boot
4: 0C 1023 254  63 - 1023 254  63 [ 725282816 -  251490304] Win95 FAT32L

EDIT:

After trying another solution I can't boot on my Windows partition anymore. The partition information is the same above.

Best Answer

I'm pretty sure you've created a highly dangerous and inconsistent layout.

The problem is this: Macs that dual-boot with Windows generally use a hybrid MBR, which is a way to get two partition tables to (sort-of) coexist on a disk. The GUID Partition Table (GPT) is the authoritative partition table and is the one that MUST be modified by any tool that resizes partitions. In a hybrid MBR setup, one or more normally-empty fields in the Master Boot Record (MBR) are employed to replicate data in the GPT data structures. When confronted with a hybrid MBR disk, OS X uses the GPT data, whereas Windows uses the MBR data. A hybrid MBR is also used as a signal to the Mac's firmware that the disk may be booted in BIOS mode (vs. the EFI mode that OS X uses).

The trouble with this is that if you use a GPT-unaware tool to resize, move, or create partitions, you'll be changing the unauthoritative MBR data structures while not changing the authoritative GPT data structures. That's sort of like entering a deposit in your checkbook without actually depositing a check -- it may look cool to have $1,000,000 in your bank account, but if you try to use the money, you'll be in trouble! This is (I think) what you've done -- by changing the MBR data structures, you've created a partition that Windows can use but that OS X can't. Worse, depending on the details of what you've done, you may be damaging one OS's files whenever you write information in the other OS.

To recover, I recommend that you first back up everything to another disk.

With that done, you can attempt a data recovery by examining the start and end points of both the GPT and MBR data. You can do this with gdisk -- an ordinary p command displays the GPT data; and in the experts' menu or the recovery menu, an o command displays the MBR data. (Ignore the type-0xEE MBR partition; that signals that the disk is a GPT disk, nothing more.) Figure out which partitions match and which don't. Make note of which partition(s) you use from OS X, and which you use from Windows. The Windows partitions will be on the MBR side. Once you've figured out which partitions you're using, delete the non-functional GPT partitions and, in their place, create new partitions with the same start and end points as the MBR partitions that work in Windows. This procedure assumes that you can actually create these partitions; if they overlap, you're in deep trouble and you'll really have to delete all the overlapping partitions, create new ones, and restore everything from your backups. Once you've done all this, you can create a new hybrid MBR, as described on my Web page.

In the future, be sure to obey Rule #1 for hybrid MBRs:

NEVER, EVER USE GPT-UNAWARE UTILITIES ON A HYBRID MBR DISK!

In some cases, you'll need to modify the GPT data structures with a GPT-only tool and then create a new hybrid MBR to reflect the changes.

Related Question