====== Compact VDI ====== ===== Windows guest ===== - Run defrag in guest - Download [[https://technet.microsoft.com/en-us/sysinternals/bb897443|SDelete]] from Sysinternals and run this || sdelete c: -z - Shutdown the guest ===== Linux guest ===== - Run the following commands in guest: \\ **sudo dd if=/dev/zero** | **pv** | **sudo dd of=/bigemptyfile bs=4096** \\ **sudo rm -rf /bigemptyfile** - Or run theese commands: \\ **telinit 1** \\ **mount -o remount,ro /dev/sda1** \\ **zerofree -v /dev/sda1** - Shutdown the guest ===== Windows host ===== - run: \\ "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd c:\path\to\vdi\disk.vdi compact ===== Linux host ===== - run: \\ vboxmanage modifyhd /path/to/vdi/disk.vdi --compact ===== OSx host ===== - run: \\ VBoxManage modifyhd /path/to/vdi/disk.vdi --compact