Originally published on Medium
I use a VirtualBox setup on my Mac for running Ubuntu as a Guest OS. This setup helps me mock the production environment on my local dev machine. VirtualBox is a pretty handy software for anyone trying to run a guest OS. Though there is an initial learning curve while setting it up, but it’s fun. I have been using this setup for over a year now and it has served my well. Well, well until today…
Today, while working on a legendary(read as legacy) piece of software which was no cakewalk navigating through, required me to download the latest DB dumps. So, like any good programmer I tried to download the dumps, only to realise that I couldn’t do so because… my VM was out of space. I suddenly remembered the time when I allocated 20Gigs of space to the VDI, thinking that I’d never need more space than that. Haha.. was I wrong!!. Following the lazy dev protocol, I tried quickest solution; cleared up the logs and removed most unwanted files, but to no avail. Finally the time had come for me to get my hands dirty. A few search results later…
Take backup of your VDI
Fetch path to VDI
Save this path, we’ll use it in the next steps
Right click on VM -> Click Settings-> Storage -> Select your VDI on the Storage Tree on the left -> Location would have the path to your .vdi
- Shutdown the VM and quit VirtualBox
- Navigate to VBoxManage utility folder Open the Terminal app and type the following command
- Modify the size allocated to the VDI Use the VDI path from above and use it in the below command
VBoxManage modifyhd — resize [new size in MB] [/path/to/vdi]
Tip: Notice the ‘\’ before the space. This is used to escape the space character in path.
- Verify if the desired changes were successful
VBoxManage showhdinfo [/path/to/vdi]
- Launch the VirtualBox and VM
Tip: You may need to reallocate the partition to use the new space.
Note: I am using VirtualBox version 5.1.14. You may want to use modifymedium instead of modifyhd if you are on a newer version, though modifyhd is still supported.
A few search results later…
… I was happily downloading the DB dump on my VM and completing this blog post in the meanwhile. :)