You have to do the following steps:
- run defrag in the guest (Windows)
-
nullify free space:
With Linux guest run this:
sudo dd if=/dev/zero of=/bigemptyfile bs=4096k sudo rm -rf /bigemptyfileWith Windows guest, download SysinternalsSuite and run this:
sdelete –z -
shutdown the guest VM
-
now run VBoxManage's
compactcommandVBoxManage.exe modifyhd thedisk.vdi --compact
This reduces the size.
This works for Mac OS X
Open Terminal
Enter the following command:
VBoxManage modifyhd -compact “/Users/user1/VirtualBox VMs/Windows 7/Windows 7.vdi"