By Fat Bloke on Dec 14, 2012
Don't you just hate it when this happens:
Fortunately, if you're running inside VirtualBox, you can resize your virtual disk and magically make your guest have a bigger disk very easily. There are 2 steps to doing this...
1. Resize the virtual disk
Use the VBoxManage command line tool to extend the size of the Virtual Disk, specifying the path to the disk and the size in MB:VBoxManage modifyhd <uuid>|<filename> [--resize <megabytes>|--resizebyte <bytes>]
If you booted up your guest at this point, the extra space is seen as an unformatted area on the disk, like this:
So we now need to tell the guest about the extra space available.
2. Extend the guest's partition to use the extra space
How you do this step depends on your guest OS type and the tools you have available.
Linux guests often include the excellent gparted partition editor, whereas Windows 7 and 8 provide the Computer Management tool which can resize partitions.
Unfortunately, with Windows XP the Computer Management tool couldn't do this. But I do have a couple of other options:
Most Linux installable .isos include the aforementioned gparted tool, so I could simply attach, say, an Ubuntu install iso as a Virtual CD/DVD in my Windows XP vm and boot off that. (NB don't install Ubuntu, just run it from the CD). Then use gparted to extend the Windows XP partition, before finally rebooting.
But I took another route and plugged my resized virtual disk to a Windows Server 2012 vm I had lying around. Then I used the Computer Management tool in Windows Server 2012 to extend the partition of the Windows XP disk, before shutting down, unplugging the disk and reattaching to my Windows XP vm. (Note that if your vm's use different disk controllers, Windows will check the disks on booting, don't worry).
When I finally boot up my Windows XP guest I see the available disk space and all is well.
At least until the next time