Advertisement

How to resize a VirtualBox HDD image (VDI)

When creating a virtual machine with VirtualBox, it is easy to choose the wrong size for the virtual HDD. Some day, you might face the issue that there is not enough free disk space left in the virtual machine. Here is how you can resize a VirtualBox HDD image (VDI) without data loss or without reinstalling the guest operating system.

Advertisement


VirtualBox ships with a console tool VBoxManage, which can do a lot of tasks not accessible from the user interface. For example, using VBoxManage you can adjust the BIOS date and time for virtual machines. This tool can be used to resize VirtualBox HDD images.

The command line syntax is as follows:

VBoxManage modifyhd path_to_vdi_file.vdi --resize desrired_size_in_megabytes

For example, let's resize the disk drive connected to my Arch Linux virtual machine. Right now, its HDD size has a capacity of 20 GB:

Virtualbox current disk size
Let's say I want to make it 30 GB. To do this, issue the command similar to the command below.
Under Linux:

VBoxManage modifyhd '/home/user/Arch VM/Arch VM.vdi' --resize 30720

Under Windows, you need to open a new command prompt window in the folder C:\Program Files\Oracle\VirtualBox. See the following article: All ways to open the command prompt in Windows 10, and the part "Run the command prompt directly from Explorer". The command will be the same:

VBoxManage modifyhd "c:\Virtualbox VMs\Arch VM\Arch VM.vdi" --resize 30720

Note: The size above is expressed in megabytes so 30 x 1024 = 30720.

Correct the path portion to match the actual path in your environment.
Tip: You can see the path to your VDI file in Virtual Media Manager:Virtualbox disk path

The command works quickly. The VDI file will be resized within a second:Virtualbox resize hdd vdi disk

Now click "Refresh" in Virtual Media Manager. It will reflect the changes:Virtualbox new disk size

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

4 thoughts on “How to resize a VirtualBox HDD image (VDI)”

  1. Just note that after you resize the disk, just like “real life”, you will need to resize your partition in Linux (if your guest is linux) to take advantage of the new space. You can do this very easily with gparted.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.