Shrinking VirtualBox VMs Under Windows

  • Remove all unnecessary applications and files, empty the trash, etc.
  • Do a defrag. You can use Defraggler if you want.

Use sdelete to write all zeros to the free space by downloading sdelete and extract it to your desktop.

Open a command prompt and cd to the sdelete directory. Type in the following command:

sdelete -z c:/
This will write zeroes to all the free space in your C: drive. Once it’ done, shutdown the VM.

Now we can use the VboxManage command (This was tested using version 5.0.2.6) . This should be in your path already but if not add it.

Open a command prompt where your vdi file is located and use the command as follows:

vboxManage modifyvdi /path/to/your/VM.vdi compact

Give it some time, possibly hours depending on the size of your vdi file and it should shrink down to the actual usage of the data in the vdi file.

Leave a Reply

Your email address will not be published. Required fields are marked *