Growing your VirtualBox Virtual Disk
- by Fat Bloke
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>
[--type normal|writethrough|immutable|shareable|
readonly|multiattach]
[--autoreset on|off]
[--compact]
[--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 you 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, my Windows XP vm has no such tool. 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.iso as a Virtual CD/DVD in my Windows XP vm and boot off that. Then use gparted to extend the Windows XP partition, before finally rebooting.
But I took another route and attached 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).
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
- FB