Resizing an OSX partition on a VM hosted on ESXi.

Update 11/2/2014: We are successfully virtualizing Mavericks (10.9) and it is possible to resize disks online without having to go through the following guide. It still applies to Mountain Lion (10.8) and earlier versions.

One of the great things in vSphere 5.1 is that the Mac Pro is a fully supported server for ESXi. That means you can virtualize OSX on supported and recent hardware.

While the templating and integration is not as great as with Windows and Linux, you can deploy VMs in a reasonably short amount of time. Just make sure you don’t check the “Edit virtual hardware (Experimental)” box as it may blow your template up.

If you attempt to grow the disk, you will get a “Partition failed” error message in OSX “MediaKit reports partition (map) too small.”. No matter how many times you try it won’t work…

At this point you have 4 options:

Since I didn’t have time to place a purchase request and didn’t have much time, I used a PartedMagic iso I already had in one of my Datastores. Only to notice that the iso wouldn’t boot. This is due to the fact that OSX VMs are running in EFI boot mode only.

Fear not, there is a way to get it to boot:

  1. Shut your VM down.
  2. Right click > Edit Settings.
  3. Increase the disk space to the capacity you want.
  4. Go to the options tab, change the “Guest Operating System” to Windows and select any flavor of Windows in the drop down menu.
    From this:
    To this:
  5. Then, still in the Options screen, under “Advanced > Boot Options”, change the boot firmware from EFI to BIOS.
  6. Your VM should now be able to boot from the ISO.
  7. In PartedMagic, start Partition Editor, you should see an error message similar to this:
    Click Fix. If another dialog prompts you to fix something else, click Fix again.
  8. Add a FAT32 partition in the empty space.
  9. Click Apply.
  10. Shut down and revert the Guest OS and Boot Firmware options.
  11. Boot into OSX, delete the FAT32 partition and resize your main partition.
  12. You’re done.