User Tools

Site Tools


compact_vdi

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
compact_vdi.txt · Last modified: 2017/08/10 10:59 (external edit)