How to resize VirtualBox partition using VBoxManage command

Use VBoxManage modifyhd command

VBoxManage modifyhd "path-of-disk-file" --resize 20000

Steps for VDI file

Use the following command to increase the size of the drive:

VBoxManage modifyhd <absolute path to file> --resize <size in MB>

Example: I have a 10GB drive that I want to be 20GB the command would be.

VBoxManage modifyhd <absolute path including the name and extension> --resize 20480

Download the Gparted live cd or what ever partition manager program you wish and mount it to the guests virtual CD and boot the guest.

From here you can expand the primary partition to use the new space. Windows Vista and newer guests can use the Disk Management to expand the primary partition.

Steps for VMDK file

Follow the excellent solution from StackOverflow article.

Sample sessions:

# /Users/agilecreativity/VirtualBox VMs/ULTS64V03/ULTS64V01-disk1.vmdk

# This will resize the image to 50GB (50 * 1024MB)
VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 51200
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk

Followed by the following guide

Useful Links

comments powered by Disqus