When creating a VirtualBox virtual machine you can set up a VDI hard drive image to grow dynamically. This way all of the space does not get allocated right away on your physical drive, although this may not always be such a bad idea to do so. However, what do you do if you run out of that space, whether it was allocated right away or grew itself out?
The solution is quite simple and should not take more than 5 minutes from you. First, power off your VM if it’s powered on.
Then, resize the disk from the command prompt – let’s say you want your new disk size to be 50Gb (or 50 * 1024 = 51200Mb). If you forgot where your VDI file is, you can look it up by going to your virtual machine settings, then storage, and then clicking on the drive – the full path is going to be listed under Location. Let’s say it’s
vboxmanage modifyhd "E:\VBox\My Drive.vdi" --resize 51200
Now, power up your VM: you will notice that your drive size has not changed and you are still out of space. That’s because you have increased the size of your virtual hard drive to 50Gb, but your logical drive (e.g. drive C:), or partition, remains the same size. So, you need the final step: increase the logical drive size:
In the VM, launch
Computer Management by either running
compmgmt.msc from a command prompt, or simply searching for it (Win7 and Win8). Go to
Storage > Disk Management and click on the drive you want to expand. You will notice that there now is a
Unallocated Space portion there. Right-click on the partition you want to grow and select
Extend Volume – keep the size and expand it. You’re done!