Tuesday, May 15, 2012

Virtual Box disk resize



We always run into deadlocks when we need extra space on virtual machines and since the hdd is already created it becomes a problem to re size a disk. lets walk through a fast way of doing so.Using VBoxManage and Gparted

if you find reading as a boring habbit just follow the pictures :)




  1. Open a terminal and CD into your existing virtual disk, the location of the disk can be  found out by using step number
  2. Now create a new disk using
    VBoxManage createhd --filename newone.vdi --size 3000
     Where newone.vdi is the disk name if you see image above you can make anytype of supported image which means this method can also be used for vmware disks
  3. Now copy  contents of the disk which needs to be resize into this one using command
    VBoxManage clonehd packed-disk2.vmdk newone.vdi --existing
    where packed-disk2.vdmk is the original disk (10 gb )
    newone.vdi is the new 30 gb disk
  4. Now open settings of virtual machine in question
  5. Now find the storage controller and the hdd

    this can be used to locate the disk which needs to be resized

    Now change this hdd


    Remember your old disk still remains so if all this effort fails you can always switch back
  6. Now load the gparted iso file in the virtual machine

    Same way the hdd was replaced , but this time choose the cd/dvd controller
  7. Now boot up the virtual machine

    press f12 to get above screen then press c to select cd
  8. Now you will see gparted screen for booting

    select 1st options and press enter
  9. Now gparted shows you some options like keyboard layout , screen resolution , type of card and how to start x server
    my answers were 
    1. Dont touch the keymap
      1. Selected 33 us english
    2. start of the x server automatically
    3. resolution os 1024 X 768
    4. depth 24 bit 
    5. Vesa card
  10. Now you will see desktop , select Gparted icon

    Will give you a screen like this , this point onwards you can right click the partition you want to resize or move and move then. Rules of using Gparted are kinda rigid , but are straightforward
    1. you will have to adjust the partitions according to whats in front and behind the disk
    2. and move them like a puzzle till you get what you want , the disks can be graphically resized
  11. Here is how it looked while processing
  12. Here is how it looked after the partitioning was done
  13. This is how the disk utility looked after i booted my virtual machine

now after this you can either keep the earlier disk or delete it  , If the process goes wrong , then you can always restore you virtual hdd the way it was done in step 5 and you will have restored the hdd


Please do comment :)

No comments:

Post a Comment