Compact Virtualbox VDI Image to Save Space

Takes me forever to find this StackExchange post every time I need it, so I’m copying it here for ease of reference:

  1. Run defrag in the guest (Windows only)
  2. Nullify free space:

    With a Linux Guest run this:

    With a Windows Guest, download SDelete from Sysinternals and run this:

  3. Shutdown the guest VM
  4. Now run VBoxManage’s modifyhd command with the --compact option:

    With a Linux Host run this:

    With a Windows Host run this:

    With a Mac Host run this:

This reduces the vdi size.

Facebooktwittergoogle_plusredditlinkedinmail

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.