VirtualBox: Compact the VDI hard disk file

This short post will show how it is possible to compress your Windows virtual Hard Disk size in order to gain some GBs. This recommendation is valid only if you had set dynamic expanding storage.

On your Windows ghost machine download SDelete from and on the prompt command execute (C: is my drive letter)

sdelete -c C:

In this way you mark as free all clusters that are unused by Windows.

When finished, shut down your Virtual Box and from the shell execute the following command

VBoxManage modifyvdi /home/ivan/.VirtualBox/HardDisks/WinXP.vdi compact

That’s it, you have compressed your VDI hard disk file to the really needed dimension.

See you


4 thoughts on “VirtualBox: Compact the VDI hard disk file”

Leave a Reply