Friday, July 1, 2011

VirtualBox - Increasing Disk Space for Guest OS

Context:

VirtualBox 4.0.8
Host OS:  Mac OS X 10.6
Guest OS:  Windows XP

Problem:

I need to increase the primary virtual hard drive from the default size of 10GB.  

Solution:

If you simply want to add more space to the guest os, you can easily add additional hard drives by doing settings > storage > add hard disk and designate those as secondary hard drives.  For me, I need to increase the size of the primary hard drive, because Visual Studio 2010 requires things to be installed there.  Fortunately, starting with version 4, VirtualBox has made it really easy.  
  1. Open up Terminal
  2. Run the command VBoxManage modifyhd WindowsXP.vdi --resize 40000  (WindowsXP.vdi is my disk image.  I want to increase it to 40GB.)
  3. Step 2 increases the size of the hard disk, but  to the guest OS, it is still 10GB.  To make Windows XP aware of the new size of 40GB, I need to download GParted  live CD ISO and run it.  To run the GParted ISO, go to settings > storage > Empty (CD icon under IDE Controller) > CD icon (right of CD/DVD Drive: IDE Secondary) > Choose a virtual CD/DVD disk file...
  4. Start the guest OS.  GParted will boot up.
  5. Once I'm in GParted, I can simply drag to increase the size of the partition from 10GB to 40GB.
P.S.  You, reader, may find other detailed solutions elsewhere with pictures if you need more detailed instructions.

If you happen to have vmdk file instead of vdi, you need to convert your vmdk to vdi first by doing this: VBoxManage clonehd --format VDI WindowsXP.vmdk WindowsXP.vdi



No comments:

Post a Comment