MacOS Compact VDI file

In order to compact a virtualbox VDI file and recover some of the lost space (especially useful when using a VM for your development databases) then its really rather simple:

  1. Login to the VM
  2. Run the following code:

sudo dd if=/dev/zero of=/tmp/nowt bs=4096k
sudo rm /tmp/nowt

  1. Shut down the VM
  2. Navigate to the folder containing the .vdi file
  3. Run this command:

VBoxManage modifymedium --compact [filename.vdi]

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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