Skip to content

Copying a Virtual Machine

Simon Støvring edited this page Aug 30, 2023 · 8 revisions

When managing multiple host machines, you may want to copy a virtual machine from one host machine to the other. For example when to replicate your setup when setting up a new host machine or to update all host machines after installing new software on a virtual machine.

Fortunately, the process of coming virtual machines between host machines is quite easy with Tart and SSH by following the steps outlined in this article.

Let us assume that we have the host machines A and B and that we have made changes to the virtual machine on host machine A and want to copy those changes to host machine B.

ℹ️ Note

This article will refer to the machines using "a" and "b" rather than their IP addresses to make commands easier to read. You can refer to the runners like this by setting up aliases in your /etc/hosts file or you can reference the host machines using their IP addresses.

We start by connecting to host machine A using SSH.

ssh runner@a

Then we export the virtual machine from host machine A using the tart command. In this case our virtual machine is named "ci" and we export it to the desktop of host machine A.

tart export ci ~/Desktop/ci.aar

Tart exports the virtual machine as an Apple Archive that generally have the .aar file extension.

While still connected to host machine A, we can now use the scp command to securely copy the archive to host machine B.

scp ~/Desktop/ci.aar runner@b:~/Desktop/ci.aar

After copying the archive to host machine B, we may want to remove it from host machine A again.

rm ~/Desktop/ci.aar

We will now connect to host machine B using VNC. We use VNC instead of SSH as we will need to interact with the Tartelet app which does not have a command line tool.

The first thing you should notice is that there is file named ci.aar on the desktop of host machine B.

Stop the virtual machines as described here. Make sure that no jobs are running before stopping the virtual machines.

Now open the Terminal app and run the following command to delete the virtual machine on host machine B. Remember to replace the name with the name of your virtual machine.

tart delete ci

Then import the virtual machine in ci.aar using the command below. Remember to replace the name of the virtual machine with the name of the virtual machine that Tartelet is configured to use.

tart import ~/Desktop/ci.aar ci

Finally, remove the archive from host machine B.

rm ~/Desktop/ci.aar
Clone this wiki locally