In this tutorial you will learn how to increase disk size on VirtualBox. One of the great things about installing an operating system into a virtual machine is that we can easily change the machine’s CPU utilization limit, its memory usage, and the amount of hard drive space it has. With VirtualBox, all of these hardware specifications can even be changed long after the virtual machine is created.
If you have already installed Linux or some other operating system like Windows or BSD into a VirtualBox virtual machine, and then realized that you are running out of hard drive space, don’t despair. VirtualBox gives us a simple way to increase the amount of hard drive space available to a virtual machine.
In this guide, we will go over the step by step instructions of how to increase the guest disk hard drive size for a VirtualBox virtual machine in Linux. You’ll learn a couple different methods, depending on whether you want to use the GUI or the command line to make your changes.
In this tutorial you will learn:
- How to increase VirtualBox guest disk size via GUI on Linux
- How to increase VirtualBox guest disk size via command line on Linux
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
The steps below will change the size of your VirtualBox guest disk; however, you will still need to resize the parition of your disk or create a new partition inside the guest operating system to take advantage of the new space. You can check the aforementioned link for instructions on doing that in Linux. Windows and other operating systems will require a different set of instructions.
Increase VirtualBox disk size via GUI
The GUI method has the advantage of being a little more user friendly. However, if you prefer the command line or want to do the job more efficiently, scroll down to the next section below.
- Once you have VirtualBox opened, and your virtual machine is completely powered off, get started by opening the File menu and then Virtual Media Manager.
- Click on the hard disk you wish to edit. Then, use the slider bar to adjust the size to your liking, or manually enter a number in GB or TB.
- When you’re satisfied with the changes, click on Apply for them to take effect. Then, you can click on Close to exit the current menu.
Increase VirtualBox disk size via command line
If you’re like us, and you prefer to use the command line instead of GUI whenever possible, this next section is for you. Follow along with the step by step instructions below to adjust the size of your VirtualBox virtual machine’s hard disk on the command line.
We will use the
VBoxManage command to adjust the size of a virtual machine hard disk. Use the syntax below to increase your storage to a size of your choosing. In this example, we will change our Ubuntu VM’s hard disk to 30 GB. Notice that we specify the new size in megabytes.
$ VBoxManage modifymedium ~/VirtualBox\ VMs/Ubuntu/Ubuntu.vdi --resize 30000
In this example, our virtual hard disk is stored at
~/VirtualBox\ VMs/Ubuntu/Ubuntu.vdi. Yours may be different, so adjust accordingly.
By default, VirtualBox will store your VM files in your
home directory. If you have changed this setting and are not sure where your
.vdi file is stored, you can see this information by opening VirtualBox and going into File > Preferences.
In this tutorial, we learned how to increase the size of a VirtualBox guest disk in Linux. This included two different methods, so you can choose whichever is most convenient for you, whether that be using the GUI VirtualBox application or the
VBoxManage command in your terminal. Don’t forget that you will now need to increase your guest operating system’s partition size or add a new partition to take advantage of the increase in storage.