Skip to content

Instantly share code, notes, and snippets.

@schmich
Last active January 17, 2018 09:01
Show Gist options
  • Save schmich/454d62e809b7a99993dc6b16e8f1db15 to your computer and use it in GitHub Desktop.
Save schmich/454d62e809b7a99993dc6b16e8f1db15 to your computer and use it in GitHub Desktop.
Shrink VM drive: VMWare Workstation & CentOS

Guest OS:

xfs_fsr # Defrag.
cat /dev/zero | pv | cat > /zerofile # Write zeroes until space runs out.
sync && shutdown now # Flush and reboot.
rm /zerofile && sync && shutdown now # Remove file, flush, and shutdown.

Host OS:

cd "\Program Files (x86)\VMware\VMware Workstation"
vmware-vdiskmanager.exe -d "%USERPROFILE%\Documents\Virtual Machines\MachineName\MachineName.vmdk"
vmware-vdiskmanager.exe -k "%USERPROFILE%\Documents\Virtual Machines\MachineName\MachineName.vmdk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment