Resize VirtualBox VM disk size

Published by burgerboydaddy on Sat, 02/16/2013 - 11:16

Tags 

Uh, my development VM disk is full. During last update I received notice that it cannot be done because lack of space. I have 6GB disk only for Ubuntu (12.04) and it is full... Hm, previously I had idea that only Windows require so much disk space :-).

So how to re-size that disk; There are few steps involved in the process but can be done very fast. 


Add free space to the virtual Disk


  • Go to the VM folder on your host computer
    D:\devel\VM\MyDev\
  • Since resize cannot be applied to .vmdk, it will need to be converted to .vdi format first
    D:\devel\VM\MyDev>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd "MyDev-disk1.vmdk" vm-disk1.vdi --format vdi
    Example output:
        0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
        Clone hard disk created in format 'vdi'. UUID: bddc0819-cd2f-4bd5-a29c-56f1914f104d
  • Now we need to resize that disk
    D:\devel\VM\MyDev>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd vm-disk1.vdi --resize 10240
    Example output:
        0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%



Modify your VM to use the new VDI disk


In this part we need first to download GParted ISO (http://gparted.sourceforge.net/download.php) on host computer. Select and download gparted-live-0.14.1-6-i486.iso image

Now follow next set of steps

  • Open VirtualBox and select your VM (it must to be stopped)
  • Click Storage, and there you will see current VDMK disk and its current Virutal Size (6GB in my case). 



  • Click to “-“ un-attach this disk.



  • Click “+” and select “choose existing disk”



  • Select your VDI disk and attach it



  • Now click “IDE Controller” and select to add virtual CD/DVD disk file”. Select GPartedISO you downloaded



  • Do not forget to go to the System and be sure that system will boot from CD not from HDD.
  • Click ok and now we are ready for the last test.

Change partition to use the free space


  • Start VM in VirutalBox GUI, it should boot GParted.
  • On next few screens select all default options for keyboard, language.



  • Start GParted with default option “0” when system ask which mode do you prefer.
  • At the end GParted displays VM disks / partitions. 



  • Click on Resize/Move.



  • At the end apply changes to the file system.
  • Finally change is finished and VM can be shutdown.
  • Final step, remove CD image from virtual machine and start it again.
  • Once when VM is rebooted just start terminal and type “df “in it. Disk size should be 10GB.




Comments

That is exactly what I need.
Thanks

Pages

Add new comment