Growing your VirtualBox Virtual Disk

Most people simply had to deal with proprietary software that more or less runs exclusively on Microsoft OSes. For example when I bought my Dell laptop I used the Microsoft license that I grudgingly had to bought to create a fully legal installation into a virtual machine as the physical machine never ran it. I did even the first boot using GNU/Linux. I spent the serial of my fully legally owned license to install in into a VirtualBox instance.

I underestimated the never ending space hunger of those OSes so I found useful this “Growing your VirtualBox Virtual Disk (The Fat Bloke Sings)” copied here just in case it goes offline.

Don’t you just hate it when this happens:

Out of disk-space error.low-disk-space

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:

[picture missing]

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.

Free Space

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.