Aug 15

Hi everyone,

Recently I got my 10gb Windows Virtual Machine disk full(pretty easy with all those updates…) so I had to resize it. I’m using Virtualbox as my virtualization solution. It’s free, open source, multi platform and has a great performance to match/beat commercial solutions like Parallels and VMWare.

The problem I had is there’s no resize virtual hard disk feature at the time of this writing(at least I couldn’t find it). So I had to use some extra(free) tools to accomplish this. The last part of this HOWTO is also necessary for Parallels as well, since its resize functionality won’t make Windows recognize the new hard drive size.

What we need to do, is to create a new(bigger) virtual hard drive and clone the current windows installation to that drive, so we can then delete the old hard drive. So it’s not a resize, but a cloning.

We first need to create a virtual hard drive and mount it as a slave on your Windows VM. Of course, set it to the new size you would like to use.

Once this is done, you will need to copy your existing windows installation into this new hard drive. To do this we will use Clonezilla’s live cd. Clonezilla aids in cloning/backing up systems, with special focus on targeting multiple systems. It’s a free Open Source alternative to Symantec’s Ghost Corporate Edition.

So, download the live ISO image and mount it as a CDROM drive for your virtual machine, so it boots up to Clonezilla.

Once loaded, press enter on the first option(default). It will then ask for a language (defaults to English) and a keymap. If you are not sure, just press enter on the defaults. It will then ask to start clonezilla or to open a shell. Choose to open clonezilla:

Then choose the type of cloning you want to do. In this case, choose disk/partition to disk/partition:

and then choose disk to local disk. Choose your source disk(the old smaller size one) which will probably be /dev/hda and your target hard disk(the bigger one) which will probably be /dev/hdb.

Next, we have the parameters window. I’ve unchecked the first option which was to reinstall grub in the target disk, which we don’t want since we only have Windows. So it will look like this:

On the next screen, choose to use the same partition table as the source disk.

I will then warn you a couple of times that all data in your target partition will be lost. Since we are sure about this, we continue with the process.

This may take a long time depending on the size of the source disk, so you can download GParted’s ISO image in the meanwhile for the next step.

Once the process is finished, power off the machine using clonezilla’s menu options(or just power it off).

Now, remove the old hard drive from the VM and add the new one as master. Unmount clonezilla’s ISO. If you boot your VM now, Windows should boot normally, but if you check your disk size, it will tell you the same size as the old drive. WTH! Don’t panic.

Shut down your VM again and mount GParted’s ISO so it boots from it. Choose the auto-configuration option(the first one) and once it starts up it will show you a partition manager window. It will show your current partition plus some unallocated space to the right. Right click on the current partition an choose ‘resize/move’.

The new screen will let you drag the arrows to the desired size. So go ahead with it to the far right(if you want the entire disk space for windows) and click apply.

That’s it! once it is done, you can shutdown, unmount GParted and boot into your Windows VM with brand new hard drive space and everything working as it was before.

Cheers,

Marcos.

Update: Parallels users can first resize the virtual hard drive using the included “Parallels Image Tool”, but you will need to use GParted to make Windows recognize that new size.
*******

External links:

http://www.clonezilla.org

http://gparted.sourceforge.net

http://ubuntuforums.org/showthread.php?t=634880


10 comments so far...

  • NinjaTTT Said on September 29th, 2008 at 5:54 am:

    This is really nice post!!
    Quick and easy, very informative and accurate!!
    Tnx!

  • marcos Said on September 29th, 2008 at 9:42 am:

    You’re welcome! ;)

  • Resize virtual hard disk for VirtualBox | Dark Studios Said on November 5th, 2008 at 3:29 am:

    [...] Resize virtual hard disk for VirtualBox(and commercial counterparts) [...]

  • Dirk Said on November 22nd, 2008 at 4:02 pm:

    Worked great for me - thanks!

    Sadly, the support for this in VirtualBox is completely missing.

  • Happy Man! Said on November 28th, 2008 at 7:18 am:

    Mate you are a life saver. Very easy to understand instructions that work an absolute charm. This should be put on Sun’s website if they can’t be bothered to create a fix for this! Fantastic.

  • holger Said on January 18th, 2009 at 9:09 am:

    great,
    it’s a really good howto.
    thanks

  • Abrasax Said on January 19th, 2009 at 5:47 pm:

    Very useful, thanks a lot!

  • juan234 Said on February 6th, 2009 at 3:10 am:

    Very useful and easy. The harddrive sized and booted but only the old size is recogized, Any thoughts?

  • juan234 Said on February 6th, 2009 at 4:11 am:

    Ok, I tried this procedure on a VM that had a snapshot within the HD i was tring to clone. then did the same thing on a machine with no snapshot and worked perfectly. muchas gracias markitusss!!!

  • James Said on February 11th, 2009 at 6:20 am:

    Brilliant, just what I was looking for. Thank you very much!

leave a reply