Moving VirtualBox Machines

I have a client who makes extensive use of virtual machines for a remote office. Back when I set this up (almost a decade ago), I chose Microsoft’s Virtual PC because it was free (and VirtualBox didn’t exist yet). I let Virtual PC put the config files wherever it wanted under AppData, but I kept the VHD files in a folder called C:\VMs (for easy backup purposes).

Well, time passed, and Virtual PC seemed slow and creaky. So I switched the client over to VirtualBox. There was a bit of a learning curve with this: under Virtual PC, for example, I could easily make a copy of a VHD and attach that to a new virtual machine (for a new hire, for instance). You can’t do that in VirtualBox, at least not without getting “UUID already exists” errors. You can reset this from the command-line but… eh.

In VirtualBox, the easiest way to duplicate a virtual machine is to open the management console, right-click on an existing virtual machine and choose “Clone”. You can then choose a name for the new virtual machine, and an exact duplicate will be made. Only problem is, in my case, the new hard drive will be located in c:\users\[user]\Virtualbox VMs\[new VM name] instead of C:\VMs.

Of course, I could easily just edit the backup script to include the new location. But I like having all the virtual hard drives in one location. So how can you move the virtual hard drive?

For starters, make sure the virtual machine in question is powered off. Then click File > Virtual Media Manager. Right-click on the new hard drive you just created and click “Remove”. Click “Close”, then move the VDI\VHD to its new location. Back in the VirtualBox manager, right-click on the virtual machine and choose “Settings”. Choose “Storage”, then, under “Storage Tree”, click the “Add Hard Drive” icon (the one with a tiny hard drive and a + symbol). Then choose the VDI\VHD file you just moved. OK and close out of everything, and you should be good to go!

One Reply to “Moving VirtualBox Machines”

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.