How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox

It's easy to increase the disk size of your existing virtual machines. Only a few minutes of your time.
Warp Terminal

Here’s the scenario you may come across sooner or later.

You installed one or more operating systems in VirtualBox. While creating those virtual operating systems, you also created virtual hard disks for them in VirtualBox.

You specified the maximum size of the virtual disk to say 15 or 20 GB, but now after using it for some time, you realize that your virtual machine is running out of space.

While there are ways to free up disk space on Ubuntu and other operating systems, a more robust way of handling the situation is to increase the disk size of your virtual machines created in VirtualBox.

Yes, you can enlarge the virtual hard disk in VirtualBox even after creation.

🚧
While this is a safe and tested procedure, it is highly recommended to create a backup of your virtual machine before you perform such an action.

How to enlarge VirtualBox disk size

I will show you how to resize disk in VirtualBox graphically and via command line (for Linux geeks or experienced users).

Both methods are easy and straightforward. The steps are the same for Linux and Windows.

Method 1: Using the Virtual Media Manager in VirtualBox

VirtualBox 6 added a graphical option for resizing virtual disks. You can find it on the file menu of VirtualBox window.

Go to File→ Tools → Virtual Media Manager:

virtual media manager virtualbox

Select one of the hard disks from the list that you want to modify, click on Properties from the top, or double-click on the virtual disk name.

ubuntu disk size resize

Here, you can drag the slider for "Size" or type the disk size name in the field where you see 25 GB.

Once done, you just have to hit β€œApply” as shown below.

ubuntu disk size change

If you are not sure of the name, you can go to the list of virtual machines, and check the information under the "Storage" tab to check.

virtualbox storage drive info

Keep in mind that though you increased the size of your virtual disk, the actual partition size remains the same if your space is dynamically allocated.

For that, you can download GParted ISO, mount it as an optical drive from the virtual manager settings to find the extra space as β€œunallocated” space.

gparted live iso as optical disk
Click to enlarge the image

By default, when you add the ISO as an optical drive, and re-launch the VM, it will boot into the GParted partition editor.

πŸ’‘
In case it does not boot into GParted, you can head to "System" settings of the virtual machine, and adjust the boot order to have Optical Disk boot first.

You can expand the current partition using the unallocated space or choose to make a new one if you like.

unallocated space gparted virtualbox

Here's how it looks like when you use the slider on top of the window (as shown in the screenshot below) to allocate all the free space and expand the current partition. Just hit "Resize" and it will be done.

resize current partition

Method 2: Increase VirtualBox disk space using Linux command line

If you are using a Linux operating system as a host, open the terminal and type the following command to resize VDI:

VBoxManage modifymedium "/path_to_vdi_file" --resize <megabytes>

You can convert Gigabytes to Megabytes by simply multiplying 1000 (for deci.

The resize process should finish right after you click the enter button to execute the command.

πŸ“‹
The commands modifyvdi and modifyhd of earlier versions of VirtualBox commands are also supported and mapped internally to the modifymedium command.
Increasing disk size in VirtualBox using Linux command line

If you are not sure where your virtual machines are saved, you can find the default location from the VirtualBox home page by clicking on Files β†’ Preferences or by using the keyboard shortcut Ctrl+G.

Virtual Box Preferences

Suggested Read πŸ“–

How to Install & Use VirtualBox Guest Additions on Ubuntu
Install VirtualBox Guest Additions in Ubuntu and with this, you’ll be able to copy-paste, drag and drop between the host and guest system. It makes using Ubuntu on virtual machines a lot easier.

Conclusion

Personally, I prefer to use the terminal on every Linux distribution that I use for expanding disk, the graphical option is a very handy addition to the latest VirtualBox release.

This is an easy and quick tip but a great addition to VirtualBox fundamentals.

About the author
Dimitrios

Dimitrios

Dimitrios is an MSc Mechanical Engineer but a Linux enthusiast in heart. His machines are powered by Arch Linux but curiosity drives him to constantly test other distros. Challenge is part of his per

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.