How often have we encountered a situation where the predefined disk size lacks space to accommodate more data? If you require more space on your virtual machine’s hard disk at a later stage, you will have to expand the virtual hard disk and partition. In this post, we will see how to increase Disk Size in VirtualBox.
Increase Disk Size in VirtualBox
It is important to note that you may want to back up your virtual hard disk file before performing these operations, as there is always a chance that something can go wrong. It is always a good practice to have backups. However, the process worked fine more often than not, make sure to power off your machines before going forward.
There are two ways to increase disk size in VirtualBox.
- Expand VirtualBox’s disk size with GUI
- Expand VirtualBox’s disk size with CLI
Let us talk about them in detail.
1] Expand VirtualBox’s disk size with GUI
Oracle provides a tool called Virtual Media Manager in the VirtualBox that allows us to edit your machines. Follow the steps mentioned below to expand the disk size.
- To open it, you can either use the keyboard shortcut Ctrl + D or go to File > Tools > Virtual Media Manager (In some cases, ‘Tools’ is not available, so, just go to File > Virtual Media Manager).
- Now, select the machine you want to change the disk off, right-click on it, and select Properties.
- It will give you various options, just go to Size and use the slider to edit the actual size of the device.
- Now, click on Apply to confirm your actions and you will be good to go.
Even though the disk size increases, the partition size does not change automatically. You need to expand the partition on the disk to use the extra space. For that, you need to log in to your Virtual machine and use the Disk Management Tool to extend the partition.
Read: How to install macOS in VirtualBox on Windows?
2] Expand VirtualBox’s disk size with CLI
First of all, go ahead and shut down the virtual machine, also, make sure to turn off the device and set it to Powered Off, not Saved. Now, in order to change the disk size, we need to use VBoxManage command.
Before modifying the virtual disk file, it is important to delete any associated snapshots if you use the snapshots feature in VirtualBox. This guarantees that you are modifying the correct virtual disk file and that everything will function properly afterward.
Open Run, type ‘cmd’, and hit Enter. This will open the Command Prompt for you, next up, you need to switch to VirtualBox’s program files directory using the command mentioned below.
cd "C:\Program Files\Oracle\VirtualBox"
Upon navigating to this location, open the folder of your VM and look for the file ending with .VDI extension. Now, note the name of the file along with the location. Finally, run the following command to increase the disk size to 50 GB or 51200 MB.
VBoxManage modifyhd "C:\Users\yusuf\VirtualBox VMs\Fedora\Fedora.vdi" --resize 51200
If this command doesn’t work, run the following command as VirtualBox 6.0+, introduced in 2019 doesn’t support the aforementioned commands.
VBoxManage modifymedium disk "C:\Users\yusuf\VirtualBox VMs\Fedora\Fedora.vdi" --resize 51200
This will do the job for you. However, if you get an error stating VBOX_E_NOT_SUPPORTED, check and ensure that you are not shrinking the drive as the –resize command takes the final size as the input. So, if the current size of your disk is 16GB and you are trying to resize it to 8GB, it won’t work.
You need to extend the partition as well to use this extra space. There are many ways to do the same, try using Paragon Partition Manager, which is a free tool this time.
That’s it!
Read: How to install VirtualBox Guest Additions on Windows?
How do I increase disk size in VirtualBox?
There are two ways to increase the disk size, you can either use Virtual Media Manager or Command Prompt to do the same. We have mentioned the steps for both of them earlier in this post, just go through them and you will be able to increase the disk size and the partition easily.
Read: How to speed up a VirtualBox Virtual Machine and make it run faster
What is the maximum disk size in VirtualBox?
The graphical user interface (GUI) allows you to create hard disks of up to 2TB. For larger disks, you can use the VBoxManage command-line tool. Just open Command Prompt, go to the VirtualBox location, and then use the VBoxManage command, as we showed earlier.
Also Read: Fix VirtualBox not showing 64-bit Operating System.