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?


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.
  • how will I boot from that iso image? – user3183 Aug 16 '09 at 21:04
  • I've added steps that explain that. If anything else is unclear, feel free to ask :-) – Tomas Sedovic Aug 17 '09 at 7:24
  • To copy the files over, cp -a should probably be used instead of dd. dd copies the full filesystem, including the empty space, hence it takes a lot longer. cp -a takes care of the two things that typically pose a problem with cp: user-permissions and following of symlinks. – user4358 Aug 17 '09 at 7:38
  • nagul: wouldn't cp -a hurt all that boot sector info? I thought that cp is for files and directories copying. But in this case, a perfect clone of the hard disk is needed. I guess. – Tomas Sedovic Aug 17 '09 at 10:59
  • Specify the bock size to the dd command to make it take much less time (but still quite a long while). dd if=/dev/hda of=/dev/hdb bs=16M – Chris Nava Dec 5 '12 at 14:48

You want (at least wanted year and a half ago) to resize virtual disk used by your virtual machine. You're using VirtualBox, so it's most likely a VDI file. VDI files can be fixed or dynamic. Fixed one has all blocks (units of data in VDI files, each one has 1MB by default) allocated from the beginning, so 10GB image's size is 10GB (a bit more actually, because you have some metadata, but it would be presumably even less than 50KB in your case). Dynamic file grows as you write to it, at the beginning having 0 preallocated blocks (VDI consists only of metadata).


I describe only expanding of the image. It's up to you what you'll do with a new space. Your partitions with file systems can be resized after expanding or you can create new partitions. It's a separate problem, but Tomas Sedovic pointed you to GParted Live CD, which can help you in performing such tasks. Personally I prefer Parted Magic, because it has other useful tools on ISO.

Expanding fixed VDI

If you have fixed VDI, then you can use my little tool called vidma - Virtual Disks Manipulator. There is ready to use exe file for Windows (2000 and above) users. For POSIX systems (like Linux) users there is a source code that you can simply compile using make.

Vidma supports resizing in-place, i.e. it can resize your image without creating new file. In your case it would mean that you need only 40GB and a few MBs of free space to expand your image from 10GB to 50GB. It's very useful (and the main reason I wrote this tool), but if anything goes wrong (Murphy's laws are merciless) and you don't have copy of your image, then you have a real problem. That's why it's not recommended, especially for inexperienced users.

To continue you must have 50 GB and a few MBs of free space.

vidma image.vdi 51200 newimage.vdi

Before deleting old image, you should carefully check whether newimage.vdi works without problems. vidma does not change UUID of the image, so you have to remove old one from VirtualBox Virtual Media Manager before you can add resized one. You can also change UUID of new image to avoid removing the old one.

VBoxManage internalcommands sethduuid newimage.vdi

Expanding dynamic VDI

Since VirtualBox 4 you can resize dynamic VDI using VBoxManage:

VBoxManage modifyhd image.vdi --resize 51200

This command expand VDI file to 51200MB, i.e. 50GB. It will be done in-place and number of allocated blocks won't be increased, so you don't really need additional 40GB, but it's obviously required to be able to fully utilize resized image.

vidma since version 0.0.3 also supports resizing dynamic VDI files.

To get a better grasp of vidma, beside checking linked before GitHub repository, you can go to thread at VB forum. Reading vidma(1) manual page is recommended.

  • just to point out, that VBoxManag is a program found in the virtual box installation. By default, you can find it at : C:\Program Files\Oracle\VirtualBox. – Black Horus Oct 26 '11 at 13:39

Consider the easiest thing to do: add another virtual hard drive. 10GB is sufficient for a "system" partition, even for Windows. Then you add a 50GB "d:" drive. In VirtualBox you just use the Virtual Media Manager, make the drive, and add it to your machine.

Advantage: you can revert it independently of the system partition. You can even wipe and reinstall the system partition and not have your "data" partition be affected. Another one is that you can use it in more than one virtual machine (not at once, I think), INCLUDING a Windows AND a Linux guest. Nice!

If Windows is your guest OS, 10GB is enough for Windows and any other "uncool" Windows programs (most) which install all kinds of stuff in the registry and in the Windows directories. Some stuff can be installed on the data partition, like graphics libraries for programs etc.


This articles gives step-by-step instructions on how it can be done with screenshots. There is also another good article on how to do this here.

  • ok it worked, but for some reason if I remove the old hard disk, whenever I reboot and try and login the screen just goes all blue with the sound going off like I just logged in. If I re-add the old hard drive, it works (it is set to primary slave). very strange! – user3183 Aug 16 '09 at 22:24
  • The first link is now borked... – Kevin Pullin May 13 '10 at 3:48
  • You can access the link without images via the wayback machine. – Jim McKeeth Apr 27 '11 at 22:36

I don't believe it was available at the time the question was asked, but since VirtualBox 4.0 you can use vboxmanage modifyhd --resize command and then use GParted from a LiveCD to resize the operating system partition.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.