How do I change the space I allocated to my virtual hard drive in VirtualBox?

I have a Windows 7 64-bit virtual machine running inside VirtualBox. When I first setup the system I gave the virtual hard drive 20GB of space to work with, but I also set it to dynamically expand (or so I thought).

Unfortunately I ran out of space and the drive is not expanding/changing, and I can't find a way to alter the size of it. Is there anything I can do in this situation?


The command line tool VBoxManage will let you resize your guest's hard drive. Open up a command prompt/terminal/whatever for your host OS, and change to the folder where VirtualBox is installed ("C:\Program Files\VirtualBox" on Windows hosts). From there, run VBoxManage list hdds to see a list of available hard drives. Find the drive that you want to resize and copy either it's full path (after Location in the output) or UUID to your clipboard for the next command. Next, run VBoxManage modifyhd C:\Path\To\Drive.vdi --resize 30000. Replace C:\Path\To\Drive.vdi with either UUID or the full path to your drive image. The number after --resize is the new size in megabytes. If you want to go larger than 30 GB, feel free.

Once that's complete, you still have to let your virtual machine know that the new space is available to use. For Win7, that's easiest to do from Disk Management.