Increasing the size of a VirtualBox hard drive

If you’re a VM user like I am, one of the most frustrating tasks is that of trying to increase the size of a VBox hard drive.

Google searches come up with a myriad of solutions, some of them unnecessarily complex and unhelpful. Fortunately, there’s a fairly simple process to get it done right and quickly.

Step 1: Increase the size of the hard drive in VirtualBox

Using the VBoxManage program, increase the size of the vdi image using the following command. Modify it slightly based on your OS’s path deliminators. Example:

VBoxManage modifyhd "/home/mike/VirtualBox VMs/Windows XP/Windows XP.vdi" --resize 25000

The parameter of the ‘resize’ argument is the new size in MB. The above will resize to 25GB.

Now the new size will show up in VBox Media Manager, but your OS will only use the previous size (because of disk partitioning).

Step 2: Resize the partitions

This can be the tricky part. Think of your VM as a physical machine. What you’ll want to do is boot the VM from a bootable CD with a tool that can resize partitions. The disk utility on a  Ubuntu Live CD makes a good choice. Once you’re in the tool, resize your VM’s partitions and reboot it.