How to move/migrate LXD VM to another host on Linux

How to move/migrate LXD VM to another host on Linux

To move or migrate an LXD virtual machine (VM) to another host on Linux, you can use the lxd export and lxd import commands.

Here is a general outline of the steps you can follow:

  1. On the source host (the host where the VM is currently running), stop the VM. You can do this by running the lxc stop command, followed by the name of the VM. For example:
‮r‬efer to:lautturi.com
lxc stop vm1
  1. Export the VM from the source host. You can do this by running the lxd export command, followed by the name of the VM and the path to the file where you want to save the export. For example:
lxd export vm1 /path/to/export.tar.gz

This will create a tarball of the VM's state and configuration, which you can then transfer to the destination host.

  1. Transfer the exported tarball to the destination host. You can do this using any method that is convenient for you, such as scp, rsync, or a physical storage device.

  2. On the destination host, import the exported tarball. You can do this by running the lxd import command, followed by the path to the tarball. For example:

lxd import /path/to/export.tar.gz

This will import the VM into the LXD container runtime on the destination host.

  1. (Optional) Start the VM on the destination host. You can do this by running the lxc start command, followed by the name of the VM. For example:
lxc start vm1

That's it! You now know how to move or migrate an LXD VM to another host on Linux using the lxd export and lxd import commands.

Note: You may need to modify the steps depending on your specific setup and requirements. Additionally, make sure that the destination host has the necessary resources and configurations to run the VM.

Created Time:2017-10-16 14:38:50  Author:lautturi