Compressing Virtual Box VDI files

1. Clone your Virtualbox Instance

2. Attach the new VDI file as storage

3. apt-get install zerofree

4. Run the following to get a list of devices

lsblk

5. Run the following to zero out the device

sudo su
zerofree -v /dev/sda?????
poweroff

6. Run the following from your Mac commandline

VBoxManage modifyhd --compact VM-disk1.vdi

7. Package your instance

vagrant package --base NAME package.box

 

Gareth
Buy Me A Coffee
back arrowBack to Index