Re-sizing VMDK Virtual Machine Hard Disks in VirtualBox

There are those of us who went over to Oracle VirtualBox due to licensing issues in VMWare. Now I know there is Microsoft Hyper-V but that was not used for reasons that I can't be bothered to elaborate.

Back to the topic at hand, while merrily using my VMWare created VMDK hard disk in Oracle VirtualBox, I ran out of space. There is no obvious way to do this in the UI and after some digging around, there is a command line utility that does this. HOWEVER, the utility does not support re-sizing of the hard disks created by VMWare(.vmdk files) among other things.



However, there is a workaround for this, namely the "clonehd" command which also allows you to clone the virtual machine hard disk to a separate format. Now since the utility only supports VDI or VHD formats, we naturally should convert them into either one. For instance:

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe clonehd Homer.vmdk --format VHD Homer.vhd

Why Microsoft's VHD and not Oracle VirtualBox's native VDI format. Well, to be honest, there is a chance that we may go Hyper-V sometime down the track so I would rather not repeat this cloning process which would take time.

Now that we have a file format that works with the re-size tool, toss out the older .vmdk file or back it up if you are the prudent sort and do this:

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyhd Homer.vhd --resize 92160

The command above increased by hard disk size to 90 gigs of space.

Hope this helps.