Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

Shrink, compact Virtualbox disk images vdi and safe disk space

Date: 2010-04-22 00:00:00 -0400

When I create a new Virtual Machine in Virtual Box, I always choose "Dynamically expanding storage".

And when I first install the gest OS (usually Windows to run iTunes) it starts very small, just Windows 7 and iTunes on it. (My iTunes library is usually on another disk).

But I start to install and uninstall different kind of software, freewares, etc., and the image start to grow, and grow. When it comes to a point that the real space Windows is using is two thirds of the dvi image itself, it is time to optimize the Virtual Box disk image.

How to compress the Virtual Box disk image?

First step is to reclaim the free space inside the VM.

  1. Enter in your Virtual Machine Windows in this case
  2. Defrag the disks
  3. Download the nullfile.exe
  4. Execute nullfile.exe
  5. Run this from the Linux command
  6. vboxmanage modifyvdi /path/to/your/vdi-disk compact

That is all, now you should see an image almost the same size of the space windows is really using inside your Virtual Machine disk.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.