In a recent webinar someone said that it was impossible for him to set up the suggested lab environment because the required virtual machines would take up 50GB in disk space – more than that person had available. I wanted to quickly send a how-to link for running VMs from an external drive, but I was surprised that all the articles I found seemed pretty dated. Maybe nowadays everyone has a hard drive that is big enough?
Table of Contents
In all articles I checked the guidance was to shut down the VM and then use the Windows file explorer to manually move the VM to another drive, sometimes combined with a bit of “XML hacking” to lead VirtualBox the way to the new destination.
However, it’s really much easier, as now there are built-in tools that come without the risk of ending up with a corrupted VM. All tips of course do not only work for moving VMs to an external drive, but to any other location.
Moving the virtual disk image
- Start VirtualBox
- Go to File > Virtual Media Manager…:
- Select the vdi file that you want to move (the one related to the VM you want to run from another drive) and click “Move”:
That’s it – just select the new destination and VirtualBox takes care of the rest:
No manual copying around of files or editing of cryptic XML files.
Changing the default location for future VMs
You can also select your alternative drive as the new default destination for future VMs under File > General > Default Machine Folder.
Now, one last thing you’d want to make sure is that you are also moving your snapshots. Before we moved the virtual machine and also all new machines and their snapshots will be created in the new destination. But existing snapshots will remain in their “old” location.
There are different ways how you can change the snapshot location, depending on if the VM in question already has snapshots or not.
Change snapshot location if no prior snapshots exist
If the VM does not have any existing snapshots yet, it’s very easy. Just right-click on the VM, select Properties > General > Advanced > Snapshot Folder. Change it to the destination you want, click OK and it’s done.
Change snapshot location if prior snapshots do exist
However, if snapshots are already in place, moving will not work and you will be confronted with an error message when clicking OK:
In this case you have two options:
- Remove the snapshots and then complete the steps as described above. This is probably not what you’ll want.
- Change the default location for new VMs as described above and then simply clone the VM – everything, including the snapshots – will be recreated in the new location:
One thought on “VirtualBox VMs: Moving to and running from external drives”
Danke für die Info, danach hab ich gesucht:
ältere Snapshots, auf die ich voraussichtlich nicht mehr zugreife, die ich aber aus Sicherheitsgründen noch eine Weile vorhalten will,
auf ein anderes Laufwerk verschieben.