Resize An Existing .vdi Virtualbox Image – EASILY!

Written by Gregory Milby | Friday, November 20th, 2009
, , ,

Resize An Existing .vdi Virtualbox Image – EASILY!

Start off by creating a fresh new drive of the size you’re after using the VirtualBox user interface. Then, locate both the your old, smaller HD and the new, larger one and run the following command:

VBoxManage clonehd --existing oldhd.vdi newhd.vdi

After some progress indicators ahve come and gone your HD should have been cloned to the larger one. You now need to use some software to expand your drive partition into the new space. Vista and W7 have this feature built in to Disk Management, or you could use something like GParted. I have never had luck with the integrated windows disk management tools, so I opted to use a free product called EASEUS PARTITION MASTER – home edition:

resizer_toolThis tool was easy to install directly into the new vdi image.  Walked through the wizard after clicking on “Resize” – it rebooted itself and resized the partition without a fuss.

The command line entries for running the VirtualBox commands:

gmilby@gmilby-ubuntu64:~/.VirtualBox/HardDisks$ ls
XP_10GIG.vdi  xp.vdi
gmilby@gmilby-ubuntu64:~/.VirtualBox/HardDisks$ ls -l
total 6042484
-rw——- 1 gmilby gmilby      61952 2009-11-20 08:15 XP_10GIG.vdi
-rw——- 1 gmilby gmilby 6181380608 2009-11-20 07:56 xp.vdi
gmilby@gmilby-ubuntu64:~/.VirtualBox/HardDisks$ VBoxManage clonehd –existing xp.vdi XP_10GIG.vdi
VirtualBox Command Line Management Interface Version 3.0.12
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
Clone hard disk created in format ‘VDI’. UUID: 1366bb7f-e827-41de-90ce-763e82309f26
gmilby@gmilby-ubuntu64:~/.VirtualBox/HardDisks$

Resized .vdi image:
vdi_resized


Don’t forget to enter the Antispyware Give-away for December 2009!
Two lucky winners have won a free professional license of Superantispyware!

If you liked this post, please follow me on Twitter

Be Sociable, Share!

Related Posts:

  • No Related Posts

24 Responses to “Resize An Existing .vdi Virtualbox Image – EASILY!”

  1. syrbot (Greg Milby) Says:

    Virtualbox is like having an install of windows inside my linux box! http://www.attackr.com/resize-an-existing-vdi-virtualbox-image-easily/

  2. Experimentation in virtualization - Keith Bentrup’s Portforlio Says:

    [...] it’s time to resize and play with gparted. A more thorough guide is [...]

  3. Olle Says:

    Worked like a charm!!

    Replace the old.vdi image with
    VBoxManage storageattach machineB –storagectl “IDE Controller” –port 0 –device 0 –type hdd –medium /path/to/XP_10GIG.vdi

  4. Stephen G Says:

    So I successfully cloned to a larger .vdi but my in XP my system partition is still the same size, with the extra GBs as unpartitioned space. How do I resize the system (C:) partition?

  5. Monty Says:

    Perfect! Thanks a lot!

    One note when cloning on a Win7 machine the full path to the vdi disks is required i.e.

    vboxmanage clonehd –existing e:vboxhdorig.vdi e:vbhoxhd
    ew.vdi

  6. John W Says:

    @Stephen:

    The steps are:
    1. Go into VirtualBox and create your larger hd.
    2. Clone the data on your new hd using:
    VBoxManage clonehd –existing oldhd.vdi newhd.vdi
    3. Launch VirtualBox and boot into Windows.
    4. Go to http://www.partition-tool.com/download.htm and download and download the (free) Home Edition of EASEUS ALL-IN-ONE Partition Manager Software.
    5. Run EASEUS product, click on your partition, and choose the option to resize your partition and then choose the Apply button in the bottom left of the window. It will resize the partition in about 10 seconds or so.
    6. Done!

  7. baltaz Says:

    I would add to John W.’s comment that for Windows Vista and Windows 7 virtual machines, you can skip the EASUS Partition Manager installation and use Windows’ Disk Management Utility to resize your main partition with the unallocated space (Start > Run > diskmgmt.msc).

  8. Rick T Says:

    This one worked better for me…I’m running Ubuntu Lucid 10.04 64Bit and my Vbox machine was windows 7

    http://www.attackr.com/resize-an-existing-vdi-virtualbox-image-easily/

  9. Anonymous Coward Says:

    I ran this command on virtualbox 3.8.X and had to substitute the location of the -existing.

    It ended up looking like this:

    VBoxManage clonehd oldhd.vdi newhd.vdi –existing

  10. Mmaxx Says:

    In srv 2003, XP onwards, to expand partition in Windows, use the diskpart utility.

    cmd
    diskpart
    list volumes
    select volume [vol id]
    extend

    There are some gotchas – see here :
    http://support.microsoft.com/kb/325590

  11. Mike Says:

    Thank you very much for this. This tutorial should be published on vituralbox’s site.

  12. Mark Briggs Says:

    Great tutorial – why on earth is this not on the VirtualBox site? That’s where I went first and it any solution I found was just way too complex – I knew there would be an easier answer and after Googling (and finding your post) there was!

    I needed to resize a Win2k8 x64 vdi from 20GB up to 35GB – and like the post says if your running Win7/Win2k8 then you can simply use Disk Manager to extend the partition.

    Thank – this saved me a lot of headache!

  13. A L Says:

    I followed the instructions posted by cjt75 on Oct 26, 2010 10:54 AM in http://communities.vmware.com/message/1626774 using Acronis Easy Migrate and it worked out quite nicely.

  14. Nirmit Patel Says:

    Thanks a bunch. This really should be published on VB’s support section of the site!

    Anyone who is using a Ubuntu as the guest you can use System -> Administration -> Disk Utility to extend the partition!

  15. przemoc Says:

    It looks that my previous comment was filtered. I add only that my tool, vidma – Virtual Disks Manipulator, since version 0.0.3 supports resizing dynamic VDI files (fixed ones were supported from the beginning).

  16. xsara Says:

    I’ve the same problem for resizing a WinXP.vdi, my VirtualBox is running under Ubuntu 10.10.

    I’ve used the following method :

    - resizing the virtual HD
    VBoxManage modifyhd WinXP.vdi –resize 51200
    the new size is 51200 MB or 50 GB

    - boot the virtual machine with the “CD” : gparted-live-0.8.0-3.iso
    and then resize the Windows disk

    I use this procedure for years under VMware ESX with no problems and it works also for VirtualBox.

    I hope this little trick can help !

  17. VirtualBox – Redimensionar un disco « Blogging googling Says:

    [...] http://www.attackr.com/resize-an-existing-vdi-virtualbox-image-easily/ http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi GA_googleAddAttr("AdOpt", "1"); GA_googleAddAttr("Origin", "other"); GA_googleAddAttr("theme_bg", "3e3e3e"); GA_googleAddAttr("theme_text", "000000"); GA_googleAddAttr("theme_link", "bbbbbb"); GA_googleAddAttr("theme_border", "3e3e3e"); GA_googleAddAttr("LangId", "19"); GA_googleAddAttr("Tag", "linux"); GA_googleAddAttr("Tag", "aumentar"); GA_googleAddAttr("Tag", "box"); GA_googleAddAttr("Tag", "cambiar"); GA_googleAddAttr("Tag", "capacidad"); GA_googleAddAttr("Tag", "disk"); GA_googleAddAttr("Tag", "espacio"); GA_googleAddAttr("Tag", "gparted"); GA_googleAddAttr("Tag", "libre"); GA_googleAddAttr("Tag", "modificar"); GA_googleAddAttr("Tag", "modifyhd"); GA_googleAddAttr("Tag", "redimensionar"); GA_googleAddAttr("Tag", "resize"); GA_googleAddAttr("Tag", "syntax-error-unknown-option-resize"); GA_googleAddAttr("Tag", "tamano"); GA_googleAddAttr("Tag", "vboxmanage"); GA_googleAddAttr("Tag", "virtual"); GA_googleAddAttr("Tag", "virtual-media-manager"); GA_googleFillSlot("wpcom_below_post"); Escrito por cirovladimir Archivado en linux Etiquetado: aumentar, box, cambiar, capacidad, disk, espacio, gparted, libre, modificar, modifyhd, redimensionar, resize, Syntax error: unknown option: –resize, tamaño, vboxmanage, virtual, virtual media manager Dejar un comentario » LikeBe the first to like this post. [...]

  18. baum Says:

    Works great!
    It is now April-2011, and even though this post is a bit old – all the instructions work!

    I’m using a Win7 as a host to a WinXP guest.
    All I did was:
    1) clonehd as instructed
    2) Configure the machine to use the \new\ (cloned) HD.
    3) Run the machine and download Easeus Partition Master
    4) Run partition master, and resize partition from within windows.
    It doesn’t even need to reboot, and takes a snap!

    Many thanks man!

  19. Mutedhorn Says:

    Help!

    I just wen through the tutorial and now I’m getting a FATAL Could not read from boot medium.

    I tried reattaching both the new and the old hard drive to the IDE controller but neither of them work.

    What should I do!!

  20. A.Jesin Says:

    Wow excellent tutorial. But I wish even virtualbox had an expand option like VMware Player to make things easier

  21. Port Forward Podcast Says:

    There is a much easier way to do this. simply use the “modifyhd” command. On my mac it looks something like this:

    /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd /Users/abc/VIRTUAL/newxp.vdi –resize 10000

    This will resize the newxp.vdi drive to 10Gigs. The size given after –resize is in megabytes.

    Make sure to give the full path of the vdi, not relative!

    -Port Forward Podcast

  22. vlive Says:

    Diff way .. very simple
    http://blog.v-live.pl/2011/09/14/change-vdi-image-size/

  23. How To Resize A VirtualBox VM In 3 Easy Steps « MehulHarry.com Says:

    [...] to this post for majority of the initial guidance. LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", [...]

  24. DC Says:

    Use the program CloneVDI. Creates a copy and gives you the option to resize the drive as well.

Leave a Reply