How to Shrink VirtualBox VM of WinXP


When using VirtualBox, the size of VM expands over time. In case of running out of hard disk space, I would like to shrink the VM to free up unused space.


VirtualBox 3.2.12

VM Guest: WinXP


Step 1. Open VM Guest and perform a hard disk defragmentation (Disk Defragmenter).

Step 2. Execute SDelete to zero the free space.

sdelete -z

Although the VirtualBox manual says that use sdelete -c to zero the free space, I found that execute sdelete -z is better?

Step 3. Shutdown VM and back to the Host machine.

Step 4. Execute

VBoxManage modifyhd [vm filename.vdi] --compact

• The vm filename could be the base images or snapshots.

• Currently this command only supports VDI format.

Step 5. Done.

How to convert VirtualBox VMDK to VDI



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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s