Extending disk size on VirtualBox


#1

Sometimes it is needed to extend the size of the disk which is used by VirtualBox.

To do this, you have to extend physical size of the disk image file. For example if you have disk file named WindowsC.vdi with 25 GB of size and you want to make it 50 GB, locate the image file and run the following command:

$ VBoxManage modifyhd Win7.vdi --resize 50000

If you got an error like this:

VBoxManage: error: Cannot register the hard disk 'WindowsC.vdi' {114b110c-65bd-4088-b3e1-7770bf39675d} \
because a hard disk 'WindowsC.vdi' with UUID {114b110c-65bd-4088-b3e1-7770bf39675d} already exists

you have to give disk image parameter by its uuid value which shown in error message:

$ VBoxManage modifyhd 114b110c-65bd-4088-b3e1-7770bf39675d --resize 50000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

After that, you have to start your virtual machine and extend the partition on that disk and resize the filesystem. This procedure depends on the operating system and filesystem in use.


#2

Command syntax a little bit changed for newer versions like that:

$ VBoxManage modifymedium disk Win7.vdi --resize 50000