How to increase a virtualbox' disk size?

The title says it all.

I created the disk and now I would like to increase its size. I know I could add a new one, but I don't want to.

The guest os in question is Ubuntu 11.04


There is a very good blog entry on this at http://trivialproof.blogspot.com/2011/01/resizing-virtualbox-virtual-hard-disk.html

Basic instructions, to resize to 30G:

  1. Shutdown any VM using the disk.

  2. "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd c:\path\to\ubuntu_big.vdi --resize 30000

  3. Download and boot to a Gparted "live CD" ISO (necessary because you can't adjust the partitions on a drive that you have mounted--for instance your boot drive). Linux live CD might work also.
  4. (if you have a swap partition) follow the instructions on the blog post to "move it to the right". If that doesn't work (it doesn't let you resize it--the left arrow doesn't work) then your swap partition might be contained in a secondary partition. In this case right click on the dashed cyan line surrounding the swap partition, and choose move/resize. Now "move" it to also include all the unallocated space (it won't let you move the left-most side yet) and click ok. Then right click on the "internal" partition (now located at the very left most end of the a larger partition), and "move/resize" it to the very end of that partition (you can just click in the middle and drag it to the right). Now move/resize the external partition "all the way to the right" (it lets you now). This should effectively move your unallocated space "next to" your main partition.
  5. Resize your main partition to also include the unallocated space next to it.
  6. Click "apply"
  7. Reboot to your main OS, you should see the new space available.