Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


Compact VDI

Windows guest

  1. Run defrag in guest
  2. Download SDelete from Sysinternals and run this || sdelete c: -z
  3. Shutdown the guest

Linux guest

  1. Run the following commands in guest:
    sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096
    sudo rm -rf /bigemptyfile
  2. Or run theese commands:
    telinit 1
    mount -o remount,ro /dev/sda1
    zerofree -v /dev/sda1
  3. Shutdown the guest

Windows host

  1. run:
    “c:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd c:\path\to\vdi\disk.vdi compact

Linux host

  1. run:
    vboxmanage modifyhd /path/to/vdi/disk.vdi –compact

OSx host

  1. run:
    VBoxManage modifyhd /path/to/vdi/disk.vdi –compact


Enter your comment:
G A M​ D X
compact_vdi.txt · Last modified: 2019/10/31 08:29 (external edit)