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]

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

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