Resize VirtualBox disk image (dynamically allocated) in 30 seconds

There is a lot of unnecessary blah-blah in the Internet about resizing existing VirtualBox disk image without loosing data. In fact, this process is amazingly fast and awfully easy.

Easy, if you smart create dynamically allocated disk. But, who in these days, is using fixed disks? :>

It goes like this (in cmd.exe):

cd C:\Program Files\Oracle\VirtualBox
VBoxManage modifyhd [path] --resize [size]

Where:

  • [path] is full path, including virtual hard drive’s name and extension, and
  • [size] is destination size, given in megabytes (for example 28672 corresponds to 28 GB virtual hard disk)

After executing above, you get:

0%… 10%… 20%… 30%… 40%… 50%… 60%… 70%… 80%… 90%… 100%

and… that’s it. Amen. Check disk size in your VirtualBox.

Note, that on contrary to some believes and assumptions, this can be performed successfully with

  • VirtualBox open and
  • having virtual machine, that uses particular .vdi file, listed on left pane.

It, of course, can’t be in running state.

More details and some optional switches can be found in this Super User answer.

Leave a Reply