Managing VirtualBox VDI size for a Linux Guest

If you are just looking to save space on your operating drive, always remember to use the Description box for snapshots and delete those you no longer need.

And if the guest host is Ubuntu, see some good pre-wash steps at

Assuming you are using a dynamic disk you can perform the following steps below save more space:

Check for a dynamic disk VDI
Verify the VDI is a dynamic disk

From within the Linux guest, run the following in a terminal:

dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k ; rm /var/tmp/bigemptyfile

It will take some time to complete. Depending on the size of the disk and the amount of empty space, it can be a long time, so be patient.

When the commands complete, shut down the guest.

The next step is to run VBoxManage.exe. First, locate where VirtualBox is installed. This is usually C:\Program Files\Oracle\VirtualBox, though you can also find it by checking the path of the VirtualBox launch icon:

Find the VirtualBox install location from the launch icon properties
Find the VirtualBox install location from the launch icon properties

Open a commend prompt (search for cmd.exe) and cd to where VirtualBox is installed:

cd "C:\Program Files\Oracle\VirtualBox"

Locate and copy the path to the VDI:

Locate and copy the path to the VDI
Then run VBoxManage as follows:
VBoxManage.exe modifymedium disk “[absolute path]” –compact

VBoxManage.exe modifymedium disk "T:\VirtualBoxes\Ubuntu_21.04_withVPN\Ubuntu_VPN_21.04-disk002.vdi " –compact

I also back mine up, which is why I need to reduce the size.

VirtualBox Export Appliance Menu


© Scott S. Nelson

Leave a Reply

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