VirtualBox – reduce max-size of dynamic .vdi hard disk

virtualbox

I'm trying to reduce the maximum capacity of a .vdi file (hard disk) for one of my VMs.

I set it as dynamically-allocated with a maximum capacity of 25GB. I want to reduce this to 10GB.

NOTE: I do not want to compact the size of the .vdi file on my host machine. Then I could just use VBoxManage modifyhd --compact /path/to/my/vdi. However, although this reduces the footprint of the .vdi file on my host machine, the guest will still report a 25GB hard drive.

What I want to do is reduce the maximum capacity of the .vdi such that the guest reports a 10GB hard drive (I have already adjusted my partitions within the guest such that my partitions only take up 10GB total, and the other 15GB comes up as unallocated space).

What I have tried

I tried using the same command one uses to increase the size of the disk:

$ VBoxManage modifyhd Arch\ Linux\ Aug\ 2012\ Clone.vdi --resize 10240
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

It seems not to be supported (and the .vdi is definitely a dynamically-allocated .vdi, not a fixed-size one).

cheers.

Best Answer

Correct. You cannot downsize a VDI file, even if it does have unallocated disk space. At least not with the current version of VirtualBox. The only thing --resize can do at the moment is to increase the size of a VDI file.

Related Question