Daily Archives: August 13, 2012

Resize a VirtualBox fixed size VDI (VirtualBox Disk Image) file

If you try and resize a fixed size VDI using the command
"C:\Program Files\Oracle\VirtualBox\vboxmanage" modifyhd "C:\vms\My.vdi" --resize 45000
in a command window you would see this error:
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!
(of course your filename, path and resize value would be different)

There is a workaround, but you will need a lot of spare disk space…

The process is:
1) Copy / clone the VDI file to a Dynamically allocated VDI using the Virtual Media Manager (output in my case is My_copy.vdi)
2) Run the command above on the copy VDI file (i.e. "C:\Program Files\Oracle\VirtualBox\vboxmanage" modifyhd "C:\vms\My_copy.vdi" --resize 45000)
3) Release and then Remove your original VDI file (i.e. My.vdi) using the Virtual Media Manager, keep the file
4) Rename your original VDI file or back it up somewhere
5) Attach the copy VDI file (i.e. My_copy.vdi) to the VM (so it will appear in the Virtual Media Manager)
6) Copy / clone the copy VDI file to a Fixed size VDI (with the original file name, i.e. My.vdi) using the Virtual Media Manager
7) Release and then Remove the copy VDI file using the Virtual Media Manager, delete the file
8) Attach the new VDI file
9) Test
10) Remove the original renamed or backed up original VDI file when you are happy

Once complete you can re-partition, extend or whatever you wanted to do in the first place.
Of course, if you wanted to, you could leave out the copy back into a Fixed size VDI and leave it as a Dynamically allocated VDI.