As part of a recent PC reorganization I wanted to move some existing virtual machines and duplicate some others. Both Windows and OS X are used as hosts and VirtualBox 4.2.4 is used all around. The process is the same whether the host OS’s are Windows or OS X although all the screenshots here are from an OS X host. Since I’m moving from VirtualBox to VirtualBox this is all pretty straight-forward. Be aware that if you are moving Windows VM’s you may have to activate Windows again once it runs on the new host.
Clone The VM To Be Moved
I always clone the VM as a first step. This makes sure all the files are in one spot and leaves unnecessary files behind. So I do this even if the plan is to delete the original VM. This also provides a nice backup for the inevitable mistake.
1. Open VirtualBox Manager, right-click the machine to duplicate and select “clone”.
2. Enter in a machine name if you do not like the default provided. Select “Reinitialize the MAC addresses of all network cards” if you plan on using both the old and new machine at the same time.
3. Wait for the clone to finish
4. Locate the cloned VM on the disk. It will be located in the default location and be a folder with the same name as the cloned machine. This can be found in preferences
Copy this entire folder to an external disk or other central location so that it can be transferred to the other machine.
Now it’s time to setup the new VM.
Setup The New Virtual Machine
VirtualBox doesn’t create the default folders until the first virtual machine is created. If no virtual machines have been created since VirtualBox was installed either create a dummy VM or create the default directory specified in settings. You can use any location, it doesn’t have to be the default. Just be sure to remember the location if it’s not the default. Copy the Virtual Machine directory from step 4 to your selected location on the new machine.
1. Select Machine -> Add from the VirtualBox Manager menu.
2. Browse to the newly copied directory and browse into it to locate the *.vbox file and select it.
3. The machine will be loaded and may be ready to use. If you want to run this machine in addition to the original machine you will have to change the machine name. You’ll also need to have selected “Reinitialize the MAC…” in step 2 of the cloning process. You can optionally rename the Virtual Machine. You may also have to do some of the additional tasks listed below.
You may have to:
- Change the network adapter used in the VirtualBox settings for the machine. If so a warning will be displayed and you’ll be brought to the correct preference setting and VirtualBox will have put in a valid entry. If you have multiple network cars you may want to change VirtualBox’s choice.
- Activate Windows (again)
- If you use Windows Home Server AND duplicated the machine (meaning both old and new will run) uninstall and re-install the connector software on the new VM.