VirtualBox Extending Disk Size

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
VirtualMachine.png Applies to DVDK

Resize a VirtualBox HD partition[edit | edit source]

The virtual disk drive included in the DVDK has a default size that should fit well for typical development tasks. Anyway, in some particular situations, you could run out of free space on the virtual machine. If you have enough free space on your physical hard drive, you can extend the virtual drive size by using the following commands:

VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

For example, you can run

VBoxManage modifyhd NELK.vdi --resize 20000

to extend the standard NELK DVDK disk size from 16 GB to 20 GB. Please note that this works only with dynamic size disk image, and not with fixed size disk images (please refer to Convert from VMDK to VDI disk format). Please note that this command doesn't automatically extend the partition size. In order to do that, you need to modify the disk partition table. But since the virtual disk contains the root partition, you can't edit the partition table, because you can do such an operation only on a un-mounted device. So you need to start the virtual machine with a Live Linux distribution (for example, Gparted) and launch the partition tool and modify the partition structure.

Convert from VMDK to VDI disk format[edit | edit source]

If the vmdk image file is already connected to a Virtual Machine, you should shutdown the VM and remove the vmdk file from the VM, since the conversion can't be done if the disk is attached. From the command line, use the VBoxManage as in the example below:

$ VBoxManage clonehd --format VDI mydisk.vmdk mydisk.vdi

Don't forget to re-attach the freshly created disk to the VM.