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 . 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.

Author: Helicopter Jeff

I'm a vinyl decal cutting and designing, Astrophotography and general photography capturing, RC helicopter/quad copter pilot, Arduino and Raspberry Pi hardware/software developer, network, scripting and troubleshooting ninja living in the metro NY area. I am passionate about my hobbies so much I do them for a living. There's nothing better than getting paid to do what you love.

Leave a Reply

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

You are commenting using your 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