Skip to content
Home

How to retrieve unused space from Ubuntu VM using vmware player

Steps to retrieve unused space

  1. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can’t be defragmented.

    sudo e4defrag /
  2. Zero-fill all unused space so VMware knows it’s indeed unused:

    dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile
  3. Run the shrink operation:

    sudo vmware-toolbox-cmd disk shrinkonly