Resizing a Virtual Machine in VirtualBox


How can I resize my Virtual Machine, it is only 10GB and I need probably 50GB for this.

Is it easy to resize the image?

Best Answer

No easy way, I'm afraid. I had to do the same thing last week and this is the only help that I got to:

This is what you've got to do:

  1. Download the GParted Live CD (the gparted-live-*.iso).
  2. Create a new virtual hard disk with the desired size (50GB in your case).
  3. In your virtual machine, add the newly created virtual drive as a IDE Primary Slave.
  4. Run the machine.
  5. Boot from the GParted iso image:
    1. From the VM's menu select: Devices > Mount CD/DVD-ROM > CD/DVD-ROM Image...
    2. In the Virtual Media Manager click on Add button.
    3. Open the gparted-live-*.iso image.
    4. Press Select.
    5. Restart the virtual machine.
    6. Press F12 when you see the Sun VirtualBox boot screen.
    7. Select the CD-ROM option.
  6. Open Terminal application.
  7. Type:

    fdisk -l

  8. Check that it shows you two partitions: /dev/hda and /dev/hdb. The first is the old disk, the second is the new one and it should not be partitioned.
  9. Type:

    dd if=/dev/hda of=/dev/hdb

    (this will probably take a long time)
  10. Run the GParted tool and resize the /dev/hdb to occupy all free space.
  11. Turn off the virtual machine.
  12. In Hard Disks settings for the VM, remove the old hard disk and set the new for IDE Primary Master.