Compact VirtualBox disk images

I’m using VirtualBox since a couple of years to run Windows on top of my Linux boxes. After a while, the virtual disk size may increase to unreasonable sizes and I was searching for an option to “compact” it like in Parallels/VMWare.

Contrary to these other virtualization tools, there is nothing in VirtualBox’ GUI to do this. Fortunately, you can use 2 tools to achieve the same goal…

First, you need to download SDelete from Microsoft and run it in the VM:

sdelete -c

Now stop the VM and compact the disk:

VBoxManage modifyhd blah.vdi --compact

That’s it, your disk is now compacted and you have probably gained a couple of GB!

Leave a Reply