Andy Hawthorne

How to boost the hard drive space for your VM

Your VirtualBox VM can sometimes outgrow the space you've given it. Here's how to fix that...

Today I hit a scenario where my Ubuntu 18.04 VM was struggling for hard drive space. Here's how to give your VM more storage space via VirtualBox settings.

I'm going to assume your host computer is a Mac. The process I'll explain here might work on Windows - I can't confirm that. 

Keep in mind that the space you are allocating to the VM is space that belongs to the host. 

I'm using a 2013 MacBook Air. Storage space is tight so I keep an eye on how I'm using the disk space all the time. 

That does mean that the moment I'm not using a file, or software package, off it goes to my backup drive - or the bin.

1. Grab some info and shut down the VM

You should shut down the virtual machine and then VirtualBox itself.

First though, inside VirtualBox, click on your VM in the list then click 'Settings'.

From the menu at the top of the window, click on 'Storage'. You'll see your hard drive listed on the left. Click on it and you'll see the disk information. 

There's two things you want to know:

Make a note of both pieces of information, then close VirtualBox down. 

2. Time for the command line...

I know, I know - the command line is scary. I promise this bit is dead easy.

Fire up the Terminal app, then change into the VirtualBox directory, like this:

cd /Applications/

You then set the new size like this:

VBoxManage modifyhd — resize [new size in MB] [/path/to/vdi]

And check that it worked:

VBoxManage showhdinfo [/path/to/vdi]

That's it. All done, now your VM has a bigger virtual hard drive. 

3. Why not install Linux on the host hard drive? 

I thought about partitioning my Mac and running Ubuntu via Bootcamp. 

You can do that. You can also install Ubuntu to an external Hard drive (a USB one for example). That's another valid option. 

The thing is, running a VM is easier. It is far less risky for your Mac (or host computer). There's less faffing about to do and it's a quick way to get set up. 

So, you've seen how easy it is to boost the hard drive space for your VM. I suspect the hardest part is trying to free up enough space on your host computer.