Increasing a VirtualBox vdi’s disk space
One of the big problems with VirtualBox, is the seeming lack of support for increasing the hard disk size of a Virtual Machine (VM). The command line tool provided with VirtualBox, VBoxManage, serves as the tool to modify and increase your hard drive settings.
Let’s start with the problem of having a Windows 7 instance that has just run out of room. In order to update the instance, completely exit VirtualBox. Then go to your Terminal window so that we can enter VBoxManage commands directly. Change Directory to where your VirtualBox VMs are being stored. On my Macbook Pro, they are stored in my user directory: ~/VirtualBox VMs/Win7Pro. Now let’s increase the VM’s disk size. Let’s say the current instance is 20G and we want to double that to 40G. Before we do this, we must be sure the disk is dynamic: The following command performs this function –>
cyrokx@ves-l4 ~/VirtualBox VMs/Win7Pro –> VBoxManage showhdinfo Win7Pro.clone.vdi
UUID: d6b6c10e-0bff-45f3-9db7-b5c21a22dcea
Accessible: yes
Logical size: 20480 MBytes
Current size on disk: 18448 MBytes
Type: normal (base)
Storage format: VDI
Format variant: dynamic default
Location: /Users/cyrokx/VirtualBox VMs/Win7Pro/Win7Pro.clone.vdi
———————————————–
Since the Format variant is dynamic default, we can easily increase the disk size by running the following command –>
cyrokx@ves-l4 ~/VirtualBox VMs/Win7Pro –> VBoxManage modifyhd Win7Pro.clone.vdi –resize 40960
Your Virtual Machine is now 40G. Once in Windows, go to Administrative Tools -> Computer Management. Go to Disk Management and extend your existing partition with the newly created disk space.
Now if your Format Variant read: fixed default, there are a number of steps you must now do. Only dynamic disks can be increased in size. Fortunately we can clone VMs and the cloning process automatically creates a clone with a dynamic disk. In our hypothetical example above, we are now going to write the steps to perform to clone and resize the disk.
Resizing the disk is a little more than trivial. The key is to ensure you keep the same UUID on the disk.vdi image that VirtualBox has registered. To resize a disk that is fixed, you must first make a copy of the .vdi you wish to increase the size of. To accomplish all of this, we are going to use the following VBoxManage commands:
- >VBoxManage showhdinfo Original.vdi
You should see a response similar to the following (be sure to copy the UUID, you’ll need it later) –>
UUID: d6b6c10e-0bff-45f3-9db7-b5c21a22dcea
Accessible: yes
Logical size: 20480 MBytes
Current size on disk: 18448 MBytes
Type: normal (base)
Storage format: VDI
Format variant: dynamic default
Location: /Users/cyrokx/VirtualBox VMs/Original/Original.vdi - >VBoxManage clonehd Original.vdi newCloneOfOriginal.vdi
- >VBoxManage modifyhd newCloneOfOriginal.vdi –resize 40960
- >VBoxManage showhdinfo newCloneOfOriginal.vdi
In the response of showhdinfo, you will see the UUID has changed. Next we need to change the cloned image’s UUID to that of the Original.vdi’s UUID. - >VBoxManage internalcommands sethduuid newCloneOfOriginal.vdi d6b6c10e-0bff-45f3-9db7-b5c21a22dcea
- Now that you have a clone with the newly increased disk space, you need to copy it over the Original.vdi.
>mv Original.vdi /some/place/special - >mv newCloneOfOriginal.vdi Original.vdi
- Start the newly expanded VM!!
There you have it. A little cumbersome, but serves the same purpose. I tend to prefer to preallocate all of my disk space fixed. But this exercise may be enough to get me to change my mind…

