I created a dynamically growing VirtualBox VDI and wanted to shrink its size after a long time of use. I briefly searched for the solution and it seems that the steps to do so are:
- Zero the free space (by creating a large file filled with zeros).
vboxmanage modifyhd <VDI> --compact.
My problem here is that the VDI size (seen in the guest) is much larger than that of the partition where the VDI resides (e.g. 2TB VDI on a 320GB partition). Is the above method still doable in this case? If not, are there any other possible solutions?
Also, if VDI fails to support such an allocation scheme, will any other virtual disk formats do?