DEV Community

Akshay Goyal
Akshay Goyal

Posted on

Increasing VirtualBox VDI storage capacity on Mac OS X

Originally published on Medium

Resizing you Virtual Box storage is as simple as resizing this image, not really<br>

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…

Steps to follow

  • Take backup of your VDI
    (https://forums.virtualbox.org/viewtopic.php?f=2&t=58803)

  • 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

Path to the VDI is highlighted<br>

  • Shutdown the VM and quit VirtualBox
  • Navigate to VBoxManage utility folder Open the Terminal app and type the following command
cd /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/
Enter fullscreen mode Exit fullscreen mode
  • 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]
Enter fullscreen mode Exit fullscreen mode

Is it over yet?

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]
Enter fullscreen mode Exit fullscreen mode

Yay!!

  • 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. :)

If you like this post, feel free to follow me on Twitter. You can also visit my Github page to checkout some interesting projects, and contribute to them.

Resources

Top comments (0)