How to move a VboxManager virtual machine to another host

Officially, this has to be done using the clone function in vboxmanager – but you may (as I did) come up in a situation where the virtualbox system in the original host for some reason is not usable.

I moved my virtual machine between two 64-bits linux systems (the original host running ubuntu, the new host running debian). First I copied the entire directory containing the vm from the old host to the new one. Then I had to look at the .vbox file in that directory (the vm is called dbserver) which starts like this:

< ?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.12-linux">
<Machine uuid="{29fc488f-7e02-4564-b407-373dd72731c3}" name="dbserver" OSType="Ubuntu_64" currentSnapshot="{bf8a6162-452f-4433-b0ac-20732c166748}" snapshotFolder="Snapshots" lastStateChange="2013-04-20T16:07:17Z">
<MediaRegistry>
...

The important part is the “Machine uuid” In the global settings file for vboxmanager, Virtualbox.xml, I had to add a line within the <MachineRegistry>


<MachineRegistry>
<MachineEntry uuid="{29fc488f-7e02-4564-b407-373dd72731c3}" src="/home/morten/VirtualBox VMs/dbserver/dbserver.vbox"/>

– then the vm could be started with the disks in the same state as it was on the old host.

There might be that I also should have added some information within <MediaRegistry>, but so far it seems to run just fine – and I can do a clone for backing up.

On the linux systems, the files for the vm are stored within ̃~/VirtualBox VMs/<vmname> – ie in my case ~/VirtualBox VMs/dbserver. The global settings file is ~/.VirtualBox/VirtualBox.xml – in other systems, it may be stored other places. – I have no idea if this will work to move a vm between two hosts with different OSs.

This entry was posted in Data, linux. Bookmark the permalink.