How to reduce disk space of .vdi VirtualBox hard-disk with a linux VM (debian)
So you are here because you want to compact your Debian VM .vdi file
Just using the vboxmanage modifyhd /path/to/my.vdi --compact does not do a lot of reduction alone.
You first have to group all the free space together, then --compact will work.
How to group all free space :
Ubuntu / Debian/ Mint :
We will use zerofree utility. To run this we must be running from a boot CD to have access to unmounted partitions. That is not too complicated. Whatever your distribution you can use a Debian live CD/DVD and boot with it.
You first need to modify your software source to use "sid" packages.
- Go into Administration > Software Sources
- Remove (uncheck) all software sources (including CD-ROMs) :
- Add these two software sources :
- deb http://ftp.us.debian.org/debian/ sid main
- deb-src http://ftp.us.debian.org/debian/ sid main
- proceed with installation
You can now install zerofree:
sudo apt-get install zerofree
Then verify which partition you want to free using the Applications > System Tools > Disk Utility
sudo zerofree -v /dev/sda1
Recent Comments