Moving and extending VirtualBox virtual machines

Running things on Apple hardware here, all those Windows-only software packages are a somewhat of a pain… As good as they are, both Qlik Sense, some of the vendor specific embedded software IDEs and other need-to-have software are Windows-only.

VirtualBox to the rescue. It is free and works really well  (I do hear good things about Parallels too, though). I have used it for years without any real issues, until recently when I simply ran out of disk space on the host iMac where it lives, as well as in the virtual machine itself. The client OS (Windows 10) simply did not have enough space to download and install service packs.

Time to upgrade.

The mission was to move the Windows 10 virtual machine (VM) to a fast, external, large USB3-connected SSD drive. Wasn’t too hard to do, but as there were a couple of challenges it’s worth documenting.

 

Move the VirtualBox disk file

Pretty simple, the idea is to remove the .vdi file from VirtualBox, copy it to the external drive and then re-attach it to the VM. Well described here, with screenshots and all.

 

 

Expand the Virtual Machine disk size

This turned out to be a bit trickier than expected. Sometime during the past years’ of upgrading Windows versions, a 450 MB partition (called “Healthy (Recovery Partition)”) was placed on the VM’s disk. Probably as part of upgrading to Windows 10, I think.

Expanding the VM’s disk is a two-step process, first expanding the max size of the .vdi file itself, then making Windows use the newly allocated space.

Expanding the .vdi file is easy. Shut down VirtualBox on the host (OSX in my case), then use VBoxManage to expand the .vdi file to desired size. Plenty of online tutorials for doing this, the syntax is

VBoxManage modifyhd “<full_path_to_vdi_file>” –resize <new_size_in_megabytes>

Starting up Windows and going into the Disk Management tool, the new space is found at the end of the disk. Which makes it impossible for Windows to extend the primary partition.  Right click on it, and the “Extend Volume…” command is greyed out.

We need to move the 450 MB recovery partition to the end of the disk. There are probably many different disk partitioning programs that can do this, I had success with the free version of EaseUS Partition Master.

After swapping places for the recovery and newly added partitions, the main Windows 10 partition could be extended. After a reboot the partition map looks like this:

Windows 10 partition map after extending disk size
Windows 10 partition map after extending disk size

Mission accomplished.

Leave a Reply

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