El Capitan Resize VM Partition So I have this VM in my VMware Fusion, I add 5GB of space to the HDD but then I got this message saying resize the partition:



But when I login to my VM and launch Disk Utility, I am not seeing the option to Resize the partition
After resizing the VM disk (in my example I added 24 GiB to the default 40 GiB) you will get following listings after opening the VM's Terminal.app and executing the commands diskutil/gpt in the VM:

Initial VM-Mac:~ VMuser$ sudo gpt -r show disk0 listing:

VM-Mac:~ VMuser$ sudo gpt -r show disk0
      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   82206864      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
   82616504    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
   83886040          7         
   83886047         32         Sec GPT table
   83886079          1         Sec GPT header


After adding 24 GiB to the VM's main disk:

VM-Mac:~ VMuser$ diskutil list
/dev/disk0 (external, physical):
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *68.7 GB    disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:                  Apple_HFS Macintosh HD             42.1 GB   disk0s2
    3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3


VM-Mac:~ VMuser$ sudo gpt -r show disk0
      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   82206864      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
   82616504    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
   83886040   50331655         
  134217695         32         Sec GPT table
  134217727          1         Sec GPT header


This means: the additional 24 GiB (50331655-7 blocks) are added at the "end" of the virtual disk - only the second gpt header/table is moved - and the Recovery HD blocks the expansion of the main volume.

You may now merge the main partition with the recovery partition. The recovery partition in the VM will be deleted (this doesn't affect your real Recovery HD):

VM-Mac:~ VMuser$ diskutil mergePartitions JHFS+ "Macintosh HD" /dev/disk0s2 /dev/disk0s3


with the result:

/dev/disk0 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *68.7 GB    disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            68.4 GB    disk0s2


You may recreate the Recovery HD by downloading and reinstalling El Capitan in the VM. This should not affect any personal data or installed apps in the VM.



Alternatively you may convert the main VM volume to a CoreStorage volume - this will keep the VM's Recovery HD:

VM-Mac:~ VMuser$ diskutil cs convert /dev/disk0s2


After a reboot enter in Terminal:

VM-Mac:~ VMuser$ diskutil cs list


Then enter:

VM-Mac:~ VMuser$ diskutil cs resizeStack lvUUID size


with lvUUID: the UUID of the Logical Volume found in the previous command and size: a size in t, g, m (e.g. 35200m or 36g). Start with a size of (disksize-1000m). In my example that's 67700m  If you get an error like:  


  Error: -69771: The target disk is too small for this operation


choose a slightly smaller size until you are successful.