Resize Virtual Hard Disk in VirtualBox

Ever run out of space on your Virtual Machine? Here’s how to fix that.

1. Ensure your virtual disk is in vdi format.

VirtualBox can use a vmdk file but the VBoxManage command line utility won’t to much with them. So, if your VM is using a vmdk you will first need to convert it to the vdi format.

# Clone the .vmdk image to a .vdi.
vboxmanage clonehd "virtualdisk.vmdk" "new-virtualdisk.vdi" --format vdi

2. Resize the disk image

# Resize the new .vdi image (100000 == 100 GB).
vboxmanage modifyhd "new-virtualdisk.vdi" --resize 100000

3. Convert vmdk back to vdi

If you were using a vmdk format originally you may want to convert back to avoid any reconfiguration in VirtualBox. Otherwise you can skip this conversion step (and future conversion steps) by editing the configuration in VirtualBox for this disk.

# Clone the .vdi to a .vmdk
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk

4. Resize the disk image using gparted

So far we have only increased the size of the disk itself, not the partitions on the disk. We will used GParted to resize the partitions.

  1. Download the gparted .iso and mount a CD/DVD drive in VirtualBox for your VM.
  2. Start your VM, and on the boot screen, hit F12 to select the gparted iso image for boot
  3. Follow the instructions and resize the partition on your new disk image so it uses all the unallocated free space.
  4. Shut down the VM and unmount the gparted ISO
You can leave a response, or trackback from your own site.

Leave a Reply