Virtualbox: Windows XP Guest on Ubuntu Linux Host: Resizing C:\

So my 10GB Windows XP VM (that'll be big enough!) ... wasn't big enough.

After some googling and some help from a friend, here's how I enlarged my image.

1. Shut down the VM.

2. From a terminal, run the following:

VBoxManage modifyhd /path/to/diskimagefile.vdi --resize SIZE-IN-MB

3. Then install 'qemu-kvm' package:

$ sudo apt-get install qemu-kvm

4. Load the network-block-device kernel module:

$ sudo modprobe nbd

5. Load the VDI file as a network block device using qemu-nbd:

$ sudo qemu-nbd -c /dev/nbd0 /path/to/diskimagefile.vdi

6. Use your favourite partitioning tool (i like gparted) to open the disk:

$ sudo gparted /dev/nbd0

Adjust your active partition size (you will see the original disk size, and available space up to the new size you set (as SIZE-IN-MB above). Commit your change. Bobs your Uncle.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Oh, Windows will want to run

Oh, Windows will want to run a CHKDSK. Let it run.
In my case the 'please wait while Windows restarts' didn't result in a restart, so after about 60 seconds I cold restarted. It then needed a restart to account for 'new installed devices'. Good ol' Windows. However, afterward, I now have more disk space on C: than when I started.