0

I have a Debian Jessie VM in VirtualBox that I use for C++ programming. The primary virtual disk is set to be dynamically allocated 32GB. Over time, I have gradually used more space on the virtual disk, but recently I cleared my Bazel cache and removed other extraneous files.

Running df -h on the VM yields:

Filesystem Size Used Avail Use% Mounted on 
/dev/sda1 31G 14G 15G 48% / 
udev 10M 0 10M 0% /dev 
tmpfs 403M 5.9M 397M 2% /run 
tmpfs 1006M 68K 1006M 1% /dev/shm 
tmpfs 5.0M 4.0K 5.0M 1% /run/lock 
tmpfs 1006M 0 1006M 0% /sys/fs/cgroup 
tmpfs 202M 4.0K 202M 1% /run/user/117 
tmpfs 202M 8.0K 202M 1% /run/user/1000

From the command output, it appears as if I have only 14GB of space used on the virtual disk, but the VDI file still has a size of 24.2GB. Is there any way to shrink the VDI to the current size of the virtual disk?

EDIT: I have looked at the tools that were recommended by the other questions. None of them work for me, as I cannot figure out how to make zerofree run on my system and sfill -fvz (from secure-delete) only makes VirtualBox think the VM uses all of the 32 GB virtual disk. I don't know where to go from here.

Thanks, Neil

ifconfig
  • 697

0 Answers0