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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s