regression towards the datascience

Resize VirtualBox hard disk


Ever tried to increase the VirtualBox hard disk space?

I am running Ubuntu 12.04 as my guest OS on Windows 7 host with VirtualBox 4.1.16. To start with, I created a 8GB VDI as a dynamically allocated storage, so that I consume space only for what I use and grow as I need it. It was all fine until 7.5GB usage, and it was later I started receiving low disk space warnings. Later on exploring about the VDI, I found that, the dynamically allocated storage is supposed to grow until 8GB only. We have to increase the hard disk space. And to do that, (say, to increase hard disk space to 15GB)

D:\VirtualBox> VBoxManage.exe modifyhd Ubuntu_12_04_dev.vdi --resize 15360

Well, I did it and still receiving low disk space warnings. Hardly I see further steps mentioned after the above command. Fortunately, after long search I found a forum talking about it.

It says, once the above command is issued, the increased hard disk space would be added as an unpartitioned disk. This has to be further partitioned and appended to the root partition. This could be done by any of your favorite partition tool. I've used Gparted to do so, as suggested in the same forum.

  1. Download the Gparted ISO
  2. Add the ISO as Virtual Disk. Boot from it using the same machine in Virtual Box
  3. Delete the swap and then extend the first partition and make sure to leave enough at the end to add the swap back.

Before partitioning

After partitioning

And here you go. All done.