If you need to resize a Virtual Machine’s Disk in VirtualBox, you can do it with one command line.
In this example I will go to resize a 20GB virtual disk to a 40GB virtual disk.
First, you have to stop the virtual machine (not suspend).
Then you have to access to the folder where VirtualBox is installed. In my server is
$ c:\Program Files\Oracle\VirtualBox
Then you have to execute the “VBloxManage” command, with the next parameters:
- “modifyhd” and the VDI file path.
- “— resize” and the new size, in MB (1GB = 1024MB).
c:\Program Files\Oracle\VirtualBox> VBoxManage.exe modifyhd "C:\Users\Administrad or\VirtualBox VMs\Debian_Linux_Desarrollo\Debian_Linux_Desarrollo.vdi" --resize 40960
Once the command has finished, you can start the virtual machine with the new hard drive size.
Now you have to resize the partition size in the VM. You can see how to make it in the post “Increase an ext4 partition with Gparted“.