VirtualBox Resize Windows XP

So there is all sorts of posts out there on how to resize a virtualbox disk when you start getting errors that Windows is running out of disk space. I found most of them to be very confusing. It’s really very fast and easy, so let’s get this done.

The first thing to do is open Terminal and switch to the directory that holds you Virtualbox machines. On Mac’s this will usually get you there:

cd ~/VirtualBox\ VMs/

Now we can simply use the command built into VB to resize the disk. Run that with the following command:

/Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd DISKNAME.vdi --resize SIZE_in_MB

Now for the fun part. If you’re running Windows 7 or higher you can just use the disk management commands in Windows itself to expand the volume, but XP doesn’t have anything like that. Instead we’ll use a sweet little utility called Gparted.

First make sure your Windows XP virtual machine is turned off. Then go to http://gparted.sourceforge.net/livecd.php and click the link to download the Gparted live CD.iso image. Once that is downloaded go to Virtualbox (don’t start any machines).

You don’t need to add another VM or anything. Simply select the WindowsXP virtual machine and click settings. Then click storage.

In the bottom left of the storages window there will be a green + sign. You want the leftmost one. Click that and select to add a new CD drive. When it asks if you have an existing disk browse to the Gparted.iso you just downloaded and select it. It should show up as the first thing in the order, which means it will boot from that first.

Now run the virtual machine. Instead of booting Windows it will boot Gparted. Follow the prompts and just accept the defaults (keep hitting enter). Then you’ll see a graphic with your disk on the left and the new unused space on the right. Click the area on the left and double click expand. You’ll be given several input boxes with the sizes of the two areas. There is a max size at the top and you’ll want to enter that number (MB) into the top box. The bottom box which is the free space should say 0. Then simply click resize. Confirm and it will work it’s magic.

Shut down the VM. Got back to settings > storage and select the CD drive you added and click the - button to remove it.

You should see the size of the disk drive in the VM summary now shows the new size. Boot into WindowsXP and it will run a few disk checks and then you’re off to the races.

comments powered by Disqus