When setting up VMs in VirtualBox, users generally don’t put much thought into how much disk space to assign. However, once you install the Guest OS and start using it regularly, the space tends to get occupied very quickly.
Increasing the amount of disk space assigned to the VMs can be a bit confusing if you’ve never done it before. As such, we’ve detailed the necessary steps to increase the VMs’ disk size in VirtualBox for Windows, Mac, and Linux.
Steps to Increase VirtualBox Disk Size
The process involves adjusting the space allocated to the VM via VirtualBox, matching the increase on the host OS, and finally managing the unallocated space directly through the guest OS.
Step 1: Allocate Space to VM
As stated, you’ll need to allocate a certain amount of disk space to the VM. Here are the steps to do so:
- Launch VirtualBox and select File > VirtualMediaManager.
- Select the Virtual Disk Image (VDI) you want to modify.
- Adjust the size with the slider and press Apply.
If you’re using a VirtualBox version older than 6, you can instead use the command-line steps listed below for resizing. On Linux systems, you can directly use the following command:
VBoxManage modifymedium <vdipath> --resize <sizeinmb>
On Windows, the command is the same. But first, you’ll have to use the following command to add VirtualBox to the PATH variable.
setx PATH "%PATH%;<VirtualBoxPath>"
Step 2: Increase Allocated Space on Host OS
If the VDI is stored on a partition with plenty of free space, you can skip this step. But if the partition where the VDI is stored doesn’t have any free space, the increased space from the previous step won’t be accessible to the VM.
As such, you’ll have to adjust the host OS’s partitions accordingly. We recommend backing up important files before performing any partitioning tasks.
On Windows, you can use the Disk Management tool for this step:
- Press Win + X and select Disk Management.
- Right-click the partition to shrink some disk space from and select Shrink Volume.
- Enter the amount to shrink in MB and press Shrink.
- Right-click the VDI partition and select Extend Volume.
- Press Next and follow the wizard’s instructions to increase the VDI partition’s disk size.
On Macs, you can use Disk Utility to manage the partitions:
- Press Command + Spacebar and search Disk Utility.
- Select the volume to resize from the left pane and click on Partition.
- From the pie chart, select the partition you want to remove and press the Remove (–) button. This will extend the deleted space to the volume you selected in the previous step.
- Before applying the changes, do note that all the data on the deleted partition will be lost. Just a quick reminder to backup any important data if you haven’t already done so.
On Linux, you can use your distro’s built-in partition manager or any other reliable option such as GParted:
- First, install GParted on Debian-based distros with the following command:
sudo apt-get install gparted
On Fedora-based distros, use the
su -c "yum install gparted"command instead.
- Launch GParted and enter your password to authenticate.
- Select the partition from which you want to shrink the space and either Resize it or Delete it.
- Select the VDI partition and resize it to include the unallocated space.
- Check the pending operations list; if it seems good, press the Apply All Operations checkmark.
Step 3: Modify Partitions in Guest OS
First, we increased the disk space assigned to the VM via VirtualBox. Then, we made sure the increased space was matched on the host OS in the second step.
While this space is now accessible to the VMs, it will be unallocated by default. Depending on what guest OS you’ve set up in VirtualBox, you can use the appropriate steps from Step 2 to modify the partitions and make the unallocated space usable.