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.


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.

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

  1. Bob

    This procedure did not work for me. Can you tell me why?

    Reply
    1. Sergey Tkachenko Post author

      I will try, if you specify more details.
      Show me please the command output.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.