Shrinking macOS guest VM .PVM files?

Discussion in 'macOS Virtual Machine' started by xmd, Nov 3, 2021.

  1. xmd

    xmd Junior Member

    Messages:
    16
    How do we shrink macOS guest VMs? I'm open to manual or automated solutions, running either in the guest VM or the host OS or both.

    With (the competitor's product) I have scripts which go something like this:

    In Guest VM:
    * diskutil secureErase freespace 0 'Macintosh HD'

    In Host OS:
    * Defragment: /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager -d /path/to/disk
    * Compact: /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager -k /path/to/disk

    This is not perfect, but does a decent job of freeing up unused space.


    Can we come up with a similar pathway for compacting PVM files in Parallels?
     
  2. xmd

    xmd Junior Member

    Messages:
    16
    So far, the only way I've found to reliably shrink an macOS VM in Parallels is to use this method:

    To shrink macOS VM in Parallels (as of version 18 in 2022) the only really effective way is to duplicate the hard drive and copy files over:
    - From Parallels VM Config, for the VM you want to shrink, go to Configure>Hardware and add a disk with the "Expanding disk" option checked.
    - This disk will only take about as much space as you are actually using.
    - Boot into the VM system
    - (optional) Rename the 2nd hard drive (so you don't mix them up, they may both be named "Macintosh HD"
    - Download the free Carbon Copy Cloner v5 (or v6, depending on which OS version) and clone your boot HD to the new HD
    - Shutdown the VM
    - From Parallels VM Config, remove the old HD, sending it to the trash (but don't empty trash yet!!!)
    - Boot the VM to confirm that it's working fine.
    - On the host machine, empty the trash to delete the old HD file

    This is adapted from here
     
  3. Aries@PF

    Aries@PF Hunter

    Messages:
    139
    Do you not have the feature that cleans up a VM when closing enabled?
     
  4. xmd

    xmd Junior Member

    Messages:
    16
    I have that enabled for VMs running Windows, and it works fine, but as far as I know, that feature does not work with VMs that are running macOS.
     
  5. Aries@PF

    Aries@PF Hunter

    Messages:
    139
    Oh, huh, I guess I didn't notice that or simply forgot about it. Weird.
     

Share This Page