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 “VBoxManage” 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“.
My jesus!!!!! Eres el Puto AMO!!!
perfect!!! its work
Si tienes un disco vmdk no te deja hacerlo, pero se puede clonar y “resizar”
vboxmanage clonehd “virtualdisk.vmdk” “new-virtualdisk.vdi” –format vdi
vboxmanage modifyhd “new-virtualdisk.vdi” –resize 30720
Después se cambia el disco de la vm ya lo tienes con el nuevo tamaño, pero te falta hacer la segunda parte del post, leelo arriba.
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«.
VBoxManage.exe: error: Failed to resize medium
VBoxManage.exe: error: Resizing to new size 47185920000 is not yet supported for medium
So apparently one can’t just resize *.vdi disks, too bad
Muy bien, genial, ¿pero qué sucede si por error te equivocas, aumentas el tamaño del disco más del que quisieras, y ahora quieres reducirlo?….