Saturday, May 2, 2015

Changing virtualbox vdi size

Running out of space in virtual machine, want to increase the size of vdi?

Follow the steps ....

I am using windows as host and virtualbox for running machines.

Pre-requisites:

Close the target machine :P

now : 

  1. Open the cmd prompt as administrator.
  2. Go to the location where virtualbox is installed.. //like  cd C:\Program Files\Oracle\VirtualBox 
  3. Strike  command // dir  ( you will find vboxmanage.exe utility don't open it i am telling you what to do..)
  4. Enter the command changing your vdi path respectively. VBoxmanage modifyhd path_to_disk.vdi --resize XXXXX  // like  VBoxmanage modifyhd "C:\Users\DELL-PC\VirtualBox VMs\localhost\OELVBX64.vdi" --resize 40000
  5. It will show output like 0%..10%.. ...  90%...100%  here after this your vdi size is modified congratulations, but in your virtual machine it exists as unallocated space.
  6. So what you have to do now is download gparted.iso named as gparted-live-0.21.0-1-i586 open link download directly, it is just approx 230mb.
  7. Considered you have downloaded gparted. Create a new virtual machine add the live cd to machine and dont create new hard disk attach the existing resized disk. run the gparted machine.
  8. Machine will start just hit enter enter enter( when required ) till you reach desktop and the gparted gui will open automatically now select the sda partition and resize the partition (pop gui will show up, there will be three textboxes in middle textbox add the max disk size(40000) and make the top and bottom textbox 0).considered no partitions you want.
  9. Apply the changes. and you are done almost.
  10. Shutdown the gparted machine  and detach the vdi and attach it in your original machine(or reattach it). Open your virtual machine check in terminal df -k it will show you the size you desired.
  11. Now you are done, congratulations.




hope i had explained clearly.. if any doubts feel free to ask. thank you :)