Recently I can into a issue with one of my Windows based VirtualBox images. It had run out of disk space. Lucky for me it is possible to increase the size of a disk image.
Backup, backup, backup
Before performing any of the following steps make sure you have a complete backup of your virtual machine.
To be able to resize a disk image the VirtualBox Guest can not have any snapshots (prior to version 4.3.*). So if your are still making use of an older version of VirtualBox you will either have to remove all the snapshots or upgrade to the latest version of VirtualBox (current release is 5.0.).
Resizing a disk image
If your are making use of disk images that are of the type (format) VMDK (Virtual Machine Disk) you will first have to clone the disk image converting it into the type (format) VDI (VirtualBox Disk Image)
VBoxManage clonehd "original.vmdk" "cloned.vdi" --format vdi
After this step you can use the resize command. The following command resize the disk image named
cloned.vdi to 51200 MB (50 GB)
VBoxManage modifyhd "cloned.vdi" --resize 51200
To convert into back into the original format (VMDK) execute the following command
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk
Wrapping it up
You can now use the resized image as disk image within your VirtualBox Guest. After Windows has booted up we still need to make sure Windows is made aware of the additional available space. To do this start Computer Management (via Control Panel -> Administrative Tools) and under ‘Storage’ -> ‘Disk Management’ perform the action ‘Extend Volume’ (by right-clicking on the partition to be extended). Accepting all the default values should be enough to