How to enlarge a VirtualBox VDI disk image

How to enlarge a VirtualBox VDI disk image

Same as one can never have enough memory, one can also never have enough disk space. Luckily, on virtual machines that’s easier to resolve than with physical hardware. But increasing the disk space available for a VirtualBox machine is still a multi-step process.

First, shut down the virtual machine OS if it is running (or suspended).

To enlarge a VDI disk image, run vboxmanage as a user that has sufficient permissions to access the storage file:

vboxmanage modifymedium disk "/vm/VMBox/VMBox.vdi" --resize 15360

The size is specified in MB. The resize should take a couple of seconds:

This step modifies the disk (image) size – the equivalent of replacing the hard disk with a bigger one while retaining existing data, but doesn’t perform any changes to the file-system itself which retains the smaller partition(s). Continue by powering on the virtual machine.

If the virtual machine is running a Linux flavor, you can do a live partition resize using multiple methods, including cfdisk and resize2fs (for ext file-systems), or resort to off-line partition manipulation with gparted. If the virtual machine is running Windows, it should be possible to enlarge the system partition live.

Leave a Reply