VirtualBox Dynamically Allocated Disk still consuming space


We know that the VirtualBox VMs when using Dynamically Allocated Disks will only consume the space from the Physical Host when used inside the VM irrespective of the disk size in VM. However, if you delete large files in the VM foe e.g. like Database Backups, you still won’t see the free space in the Windows Host. In order to release this space, you need to do below:

First connect to Linux VM and navigate to any mount with enough space to store temporary files:

su - root
cd /u01
dd if=/dev/zero of=zero.tmp bs=10M; rm -f zero.tmp

This basically is to zero out all unused disk blocks.

Now shutdown the VM. Connect to the windows CMD and run below:

C:\Program Files\Oracle\VirtualBox
VBoxManage modifyhd -compact C:\vms\ebsdbn1\ebsdbn1.vdi

This will release the unused space from the VDI images and you should be able to see the free space in Windows OS now.

There are alternative methods in :


Please enter your comment!
Please enter your name here