Lets just face it, I like VirtualBox. I have used it in numerous occasions, back from the days when it was offered by Innotek, to Sun and now Oracle. Yeah it always was a less powerful than Vmware in some areas, but when i don't need them this was as good (or maybe sometimes better) than Vmware for my basic sandboxing needs!
But sometimes I find myself in a problem which the GUI isn't always helpful for me. One of them is when in an active Virtual Machine I run out of diskspace.
There are a number of ways to increase harddisk size without destroying your data, but most of them involve cloning or copying your data to a new vdi. Though they are also relatively painless I found a much more easier solution. Or rather a one liner
The following command will operate on the VirtualBox virtual disk located at “C:\Users\rk\VirtualBox VMs\Windows 7\Windows 7.vdi”. It will resize the virtual disk to 21920 MB (20 GB).
VBoxManage modifyhd “C:\Users\rk\VirtualBox VMs\Windows 7\Windows 7.vdi” –-resize 21920
Which actually will look like the following
Then boot up the Virtual Machine. You have assigned the space but you won't be able to access it right now. So we have to make it accessible within the guest os.
Open up Disk Management tool and it will look like the following
Just select the active drive and click Extend Volume. It will automatically extend it and you will have all the space you need