Starting with version 3.1, VirtualBox supports "teleporting" -- that is, moving a virtual machine over a network from one VirtualBox host to another, while the virtual machine is running. This works regardless of the host operating system that is running on the hosts: you can teleport virtual machines between Solaris and Mac hosts, for example.
Teleporting requires that a machine be currently running on one host, which is then called the "source". The host to which the virtual machine will be teleported will then be called the "target"; the machine on the target is then configured to wait for the source to contact the target. The machine's running state will then be transferred from the source to the target with minimal downtime.
Teleporting happens over any TCP/IP network; the source and the target only need to agree on a TCP/IP port which is specified in the teleporting settings.
At this time, there are a few prerequisites for this to work, however:
-
On the target host, you must configure a virtual machine in VirtualBox with exactly the same hardware settings as the machine on the source that you want to teleport. This does not apply to settings which are merely descriptive, such as the VM name, but obviously for teleporting to work, the target machine must have the same amount of memory and other hardware settings. Otherwise teleporting will fail with an error message.
-
The two virtual machines on the source and the target must share the same storage (hard disks as well as floppy and CD/DVD images). This means that they either use the same iSCSI targets or that the storage resides somewhere on the network and both hosts have access to it via NFS or SMB/CIFS.
This also means that neither the source nor the target machine can have any snapshots.
Then perform the following steps:
-
On the target host, configure the virtual machine to wait for a teleport request to arrive when it is started, instead of actually attempting to start the machine. This is done with the following VBoxManage command:
VBoxManage modifyvm <targetvmname> --teleporter on --teleporterport <port>
where
<targetvmname>
is the name of the virtual machine on the target host and<port>
is a TCP/IP port number to be used on both the source and the target hosts. For example, use 6000. For details, see Section 8.8.6, “Teleporting settings”. -
Start the VM on the target host. You will see that instead of actually running, it will show a progress dialog. indicating that it is waiting for a teleport request to arrive.
-
Start the machine on the source host as usual. When it is running and you want it to be teleported, issue the following command on the source host:
VBoxManage controlvm <sourcevmname> teleport --host <targethost> --port <port>
where
<sourcevmname>
is the name of the virtual machine on the source host (the machine that is currently running),<targethost>
is the host or IP name of the target host on which the machine is waiting for the teleport request, and<port>
must be the same number as specified in the command on the target host. For details, see Section 8.13, “VBoxManage controlvm”.
For testing, you can also teleport machines on the same host; in that case, use "localhost" as the hostname on both the source and the target host.
Note
In rare cases, if the CPUs of the source and the target are very
different, teleporting can fail with an error message, or the target
may hang. This may happen especially if the VM is running application
software that is highly optimized to run on a particular CPU without
correctly checking that certain CPU features are actually present.
VirtualBox filters what CPU capabilities are presented to the guest
operating system. Advanced users can attempt to restrict these virtual
CPU capabilities with the VBoxManage --modifyvm
--cpuid
command; see Section 8.8.6, “Teleporting settings”.