Increase size of Virtual Box VHD/VDI image

27/08/2012

I quite often use virtual machines, especially for SharePoint development as it just tends to bloat down the host machine, when it is used for other purposes too. On my private developer machine I use Sun’s VirtualBox, a good alternative to VMWare.

Unfortunately I have a stupid habit of underestimating the storage requirements for the machines I create (Especially stupid when I always use dynamically sized disks anyway, so I could easily create them large enough initially without wasting all storage space). Nevertheless this article is about how to increase the size of an virtual disk image after they have been created, something which I have failed at 3 times in recent weeks, because of wrong advice from other blog posts — shame on you.

First a warning, if you want to increase the size of a virtual disk then TAKE A BACKUP, nothing is worse than wasting your time reinstalling because you didn’t want to wait the few minutes it would take to copy the virtual disk file to another location.

Secondly, don’t use Vboxmanage.exe modifyhd --resize if your virtual disk is in vhd format (I don’t know if it works with VDI because I had no disks in that format) and contains a windows installation, it will destroy your virtual disk and leave you unable to boot from it. You will get the following error: “Fatal could not read the boot medium! System Halted!” The above command is suggested in many places on the internet, but it has failed for me three times now with both Windows 2008R2 and Windows 2013 Server installations.

What does work though is to use CloneVDI. It will convert your VHD disks to VDI something which I’m not too happy about because I would like to have to option to use my virtual disk in with other tools too. But it increases the size without destroying the image and that is most important for me.