Why VirtualBox harddisk is always growing even though I delete files from virtual drive

virtual drivevirtualbox

I have seen it with both VBox native VDI format and VMDK format. Even though I delete files from virtual drive, I see it always keeps growing. I have some vague idea that file zero-ing doesn't happen with the virtual drives from this link. When I tried to do that with SDelete (as said in the link) it didn't reduce the VDi disk size. I have applications which once installation grows the disk to 10GB each time. I believe there should be some simple way to zero it than going through the tedious process, is there any? Is there any option in VirtualBox to keep virtual drive small?

Best Answer

When creating a new virtual machine, you are prompted to create a Virtual Hard Disk. You have two options for the disk, fixed or dynamically allocated. These are the descriptions (from virtual box) of both types of disks.

Fixed: A fixed hard disk file may take longer to create on some systems but is often faster to use

Dynamically allocated: A dynamically allocated hard disk file will only use space on your physical hard disk as it fills up (up to a maximum fixed size), although it will not shrink again automatically when space on it is freed

Chance are, you set it to dynamically allocated so the disk does not shrink again automatically when space on it is freed.