Shrink, compact Virtualbox disk images vdi and safe disk spaceFollow @ggarron
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.
- Enter in your Virtual Machine Windows in this case
- Defrag the disks
- Download the nullfile.exe
- Execute nullfile.exe
- Run this from the Linux command
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.