VirtualBox: resize disk

VirtualBox Logo

This post is a small reminder (for me) how to resize an existing virtualbox disk.

Backup existing virtualbox disk

vboxmanage clonehd /path/to/harddisk.vdi /path/to/backup.vdi

 Enlarge virtualbox disk

vboxmanage modifyhd /path/to/harddisk.vdi --resize 16384

The parameter value is the size of the hard disk after the change (in megabytes). It is NOT amount of megabyte the hard disk is enlarged.

Make new space usable

After the hard disk has been enlarged, it is not yet usable because the partition visible to the operating system still has the old value.

The easiest way is to use Gparted (http://gparted.org/). Download the Gparted LIVE ISO image and attach it to the belonging virtualbox machine.

 

virtualbox_resizehd_add_gpartedlive_01

virtualbox_resizehd_add_gpartedlive_02

Then start the VM and press F12 to open the boot menu. Then boot from CD image.

virtualbox_resizehd_add_gpartedlive_03

Apply needed changes using gparted then reboot VM from hard disk and remove gparted ISO image from machine.

If gparted is part of the system, it is also possible to boot the system first, and start gparted from your system and apply the changes as described above. This is e.g. possible if you are able to login as root and unmount the /home partition before resizing it.

Check if your system is runnng, if yes, you might want to delete your previously created backup.