Preserving VirtualBox VM’s and Configurations on a Multi-disk Host

Important background information:

My desktop computer has been running Windows 10 since I bought it about five years ago. It was clear to me that I needed to reinstall the OS but that always involves lots of backups and configuration changes. I’d rather not go through this but sometimes you need to.

My system has two drives: a 225G SSD for the OS install and a 2T hard drive for data. When I originally set VirtualBox up, I configured it to store my VM’s and the ISO farm on the 2T HD. This, it turns out, made my OS refresh easy. I currently have 19 VM’s for my various playgrounds, which would have been a real mess to deal with.

How to:

Before reinstalling the OS, you should update VirtualBox (and the Guest Additions if you also install them) to the latest edition. Make sure everything is working OK by spinning up at least one VM. Once you shut all the VM’s down, you need to locate and copy the VirtualBox configuration directory to a safe backup location. This is a hidden folder typically in your user profile named “.VirtualBox”. This folder holds both your VirtualBox configuration settings and the latest VirtualBox Extensions installer file, both of which you will need later.

Once you shut all the VM’s down, you should consider if you want to back everything up. What I did was to shutdown my computer and disconnect my HD.

WARNING: This may cause issues later. In my case after I installed the new OS and reconnected my HD, my HD assumed a different drive letter. You need to reassign drive letters immediately if this happens. I used Windows “Disk Management” tool to do this.

Once you have installed and updated the new OS, and also have your drive letter changes corrected (see warning above), do the following:

1). Install the latest VirtualBox, it should match the version you updated to prior to the OS reinstall.

2) Start VirtualBox. You will not see any VM’s listed because you have not copied the config file yet. But you should do this before copying the old config file over to the new install.

3) Stop VirtualBox.

4) Copy both the “VirtualBox.xml” and VirtualBox Extension Pack file to the new .”VirtualBox” configuration folder under your user profile, replacing the new config file with your old one.

5) Start VirtualBox and reinstall the VirtualBox Guest Additions.

6) Start up some VM’s. Hopefully everything works. If needed, you could make changes to the VirtualBox.xml file, but you shouldn’t have to.