Suppose you have virtual hard disk in VirtualBox called xp.vdi, 
you can resize it (megabytes) using the following command.
VBoxManage modifyhd xp.vdi --resize 40960
The command currently doesn't support vmdk virtual disk. 
So if you have a virtual disk called xp.vmdk,
you have to first convert it …