11

Is there a way to resize a VM hard drive? I am using virtualbox and I have a VM that has run out of space, looked into the settings but it seems I may have to create another partition. I thought there might be an easier way, anyone have an idea?

Thanks

5 Answers 5

8

You can use the VBoxManage command.

You can see details here.

Example:

"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\Users\busey\VirtualBox VMs\ubuntu10.10\ubuntu10.10.vdi" --resize 20480

After resizing hard disk , you will have to resize partition(s).

For ext3 partition you can follow these steps.

4
  • 4
    It would be nice to include the essential parts of the answer here, and provide the link only for future reference.
    – slhck
    Jan 13, 2012 at 20:47
  • Yes. I was hoping there was a way through the vbox gui but this does the trick. Jan 13, 2012 at 21:37
  • Can you actually include the steps in this answer, instead of simply posting a couple of relevant links? The links may become broken at some time in the future, and then the essential information will be gone (if the steps aren't posted here as well.) Nov 15, 2012 at 0:15
  • Do not open command line "as administrator" because you'll get Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execution failed (extended info not available). Run it as a normal user. May 22, 2013 at 21:46
5

This worked on a VHD with a bootable image of Win7:

  1. VirtualBox -> Virtual Media Manager -> Copy

  2. C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "c:\VirtualMachines\Windows 7 Large.vhd" --resize 2000000

  3. VirtualBox -> VM -> Settings -> release current VHD and mount new VHD

  4. Boot VM into Windows

  5. Use Computer Management -> Disk Manager -> right-click on partition -> Extend

3
  • What is the host OS in this example? Do these steps apply to any host operating system, or just one specific host operating system? Nov 15, 2012 at 0:18
  • Host was Win7 64-bit. Haven't tried it on other hosts.
    – Brian Low
    Nov 15, 2012 at 4:59
  • Works also on Win8 64-bit with an image of Win8 64-bit
    – Robar
    Aug 22, 2013 at 14:36
3

For a vdi this worked, the host being Windows 7.

c:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "C:\Users\busey\VirtualBox VMs\ubuntu10.10\ubuntu10.10.vdi" --resize 20480
1

CloneVDI can help do this. You can create a clone of an existing VDI and increase the disk size at the same time. Used this without any problems for a couple of years.

0

There is an article about this: http://coderjournal.com/2011/07/reducing-the-size-of-a-virtualbox-hard-drive/

Short but sufficient. In short:

  • delete temp files (obvious)
  • defragment (assuming your guest filesystem can be defragmented)
  • use VBoxManage, as other users suggest

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .