Before doing any change to your disks, it is highly recommended to make a backup of your disks images. Keep in mind that I'm only listing the steps I've followed to re-size a virtual box guest disk. You may find other problems I have not had. Do it at your own risk.
I am on a Linux host machine, but commands should be the same on Windows hosts.
You will need to boot your virtual machine with a GParted Live distribution (or any other Linux Live with Gparted like Ubuntu). If you don't have the iso, start by downloading it from here (~130MB):
Store it somewhere in your host disk.
Step1 - resize your actual virtual disk
VirtualBox has a powerful command line tool: VBoxManage. I am going to use it.
Go to where you store your virtual machine disk. In my case it is called winXP.vdi. To resize it to 20GB:
VBoxManage modifyhd winXP.vdi --resize 20000
This changes your virtual disk file to be able allocate 20000MB.
Step2 - Clone your actual virtual diskWe are going to clone our actual disk to a new one cloning all the contents:
VBoxManage clonehd winXP.vdi winXP20.vdi
This will take some time depending on the amount of data of your disk.
Step3 - Replace your VM current disk with the cloned oneFirst you need to know your Virtual Machine name. VBoxManage has a modifier to list all virtual machines on the system:
VBoxManage list vms
Once you identify your virtual machine name or UUID (a lot of hexadecimal numbers) you can replace your current disk through command line (you can do it also through the GUI)
VBoxManage modifyvm "VirtualMachine Name" --hda none VBoxManage modifyvm "VirtualMachine Name" --hda winXP20.vdi
Step4 - Boot with Gparted to resize partitionThrough GUI, set your virtual machine CD/DVD to load the GParted Live iso you have downloaded and check that CD/DVD will be the first media to use on boot.
Boot your virtual machine and follow instructions on screen. It will appear something similar to:
Select your partition, right click on it and select resize/move:
Once selected your changes, apply them:
If next error happens, simply boot into WinXp normally, run chkdsk and then boot again into GParted to resize the partition.
If you are trying to resize main disk, WinXP will ask to perform action on reboot, as it needs unique access to HDD
To be able to boot into WinXp, select the option on Grub or simply remove the iso file from the CD/DVD.