You are here
Home > How To > Resizing VirtualBox Disks Does Not Work With Snapshots

Resizing VirtualBox Disks Does Not Work With Snapshots

Resizing VirtualBox Disks – I wanted to resize the hard drive of my VM, and I figured that this would be an easy task. As it turns out, it is extremely easy. The only problem was that it wasn’t working. Here is how I resolved that error. Please note, this is my dev VM. If I mess things up, I’ll wipe it and start over. If you can’t be so cavalier about what you do on your VM’s, you better make a backup first.

Resizing VirtualBox Disks

I ran the standard modifyhd command from the command prompt. To do this, change the directory to your VirtualBox installation and run VBoxManage in this format:

VBoxManage modifyhd [path to vdi file] [dash dash]resize [size]

So the command was:

VBoxManage modifyhd D:VM’sDevABC.vdi –resize 100000

This is resizing the disk to 100Gb. Note that there is a double dash before the word resize. Also, if your path has any spaces, enclose the path in quotes. For example:

VBoxManage modifyhd “D:My VM’sDev VMABC.vdi” –resize 100000

Resizing VirtualBox Disks

When I then go to my VM’s settings and have a look at the Virtual Size, I can see that is has been resized. So far so good.

Resizing VirtualBox Disks

I then start my VM and go to Disk Management. Looking at the disk I can see that…. nothing changed.

Resizing VirtualBox Disks

Resizing VirtualBox Disks Fails Due To Snapshots

The reason that the resize didn’t work was because I had a snapshot of my VM (as this article suggests). If you’re using fixed disks, you’re out of luck too by the way. The only reliable way I found to resolve this issue was to get rid of my snapshot.

Resizing VirtualBox Disks

There is probably a better way to do this, but this is what worked for me. Power off the VM, right-click the VM and select the Clone menu item from the context menu.

Resizing VirtualBox Disks

Give your VM a new name. I wanted to create a dev specific VM anyway.

Resizing VirtualBox Disks

Select to create a full clone. I didn’t want to create a linked clone in this instance.

Resizing VirtualBox Disks

Because I wanted to get rid of the snapshots, I only selected the current machine state.

VirtualBox Snapshots

Cloning the machine takes some time, depending on the size of the VM being cloned. Now would be a good time to grab a cup of coffee or catch up on the latest hacker news.

Clone Progress

When the cloning process is complete, have a look at the disk size. You need to start the resize process from the beginning.

Cloned VM Size

Opening the command prompt, run the modifyhd command. Note that I have had to use quotes around the path because it contains a space.

VBoxManage

After this process completes, start your VM and head on over to Disk Management. You will now see that there is unallocated space available on your primary drive.

Disk Management

Right-click the partition and select to Extend the volume. Complete the wizard that follows.

Extend Volume

After the wizard completes, you will have a resized disk.

Volume Extended

There is probably an easier way to do this, but after everything I tried, this was the most direct route to resolve the problem at hand.

Dirk Strauss
Dirk is a Software Developer and Microsoft MVP from South Africa. He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix. Apart from writing code, he also enjoys writing human readable articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has yet to master.

Similar Articles

  • Daka

    Nice one

  • davidcoolman

    THANKS! totally solved my issue with resizing

    • Dirk Strauss

      Hey that’s awesome David! Glad it helped 🙂

  • ki11me

    You can use VBoxManage to increase the storage of the Snapshots VDI files as well. Use the following command while viewing the directory of your VM in a command prompt:

    for %x in (Snapshots*.vdi) do VBoxManage modifyhd –resize 100000 “%x”

  • Pingback: Compact the VDI disk | Tony's Tech Blog()

Top