How To Resize a Virtual Machine’s Disk in VirtualBox

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).

Resize a Virtual Machine Disk in VirtualBox-01

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

Resize a Virtual Machine Disk in VirtualBox-02

Once the command has finished, you can start the virtual machine with the new hard drive size.

Resize a Virtual Machine Disk in VirtualBox-03

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“.

 

Comments

5 responses to “How To Resize a Virtual Machine’s Disk in VirtualBox”

  1. Leon Velasco Avatar
    Leon Velasco

    My jesus!!!!! Eres el Puto AMO!!!

  2. chris Avatar
    chris

    perfect!!! its work

  3. AntunanSoft Avatar
    AntunanSoft

    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«.

  4. noah Avatar
    noah

    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

  5. Esteban Avatar
    Esteban

    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?….

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.