Let’s say your on a Windows box, and then you install an Ubuntu VM with VirtualBox. Maybe you give it a default 4GB or 8GB HDD, and then you start installing the things you need to work in your environment. If you’re doing web development (like me), that would be Apache (Apache2), MySQL server, phpMyAdmin, or maybe XAMPP – and maybe some dev tools. Before you know it you’re out of space on your SDA1, SDA3, or whatever your system partition is.
Maybe you think that resizing your VM (your VDI file) will fix your problem, but really it won’t. You’ll get a larger HDD grow space in VirtualBox, but your system partition will still be out of space. There’s nothing you can do about this from within your Ubuntu VM, and there’s nothing you can do from within your VM settings in VirtualBox.
What you have to do is edit your partitions and give your system partion more space. First, download the gparted live CD.
Then, in your VM settings in VirtualBox go to “storage” and click “Add/CD Device” under your IDE controller and point to the iso gparted image you just downloaded. Save and spin up your VM again, and (if your boot order was CD first) you’ll boot into the gparted live CD.
If you need help, here’s a tutorial on resizing virtualbox partitions with gparted. If you’ve never used gparted before, you might also need this tutorial on how to move swap space and paritions with gparted as well, to learn how to move the unallocated space where you need it.
Once you move the space where you need it, restart your VM and you should be good to go!