How to move an OVZ container to LXD cluster?
You can move a virtual machine (VM) created with OVZ virtualization to an LXD cluster. To move the VM:
- Save the information about permissions to VM files.
- Create an LXD container for the VM and clear it.
- Move the directory of the source VM to the created LXD container.
- Restore the permissions to VM files.
Example of moving a VM for Debian and Ubuntu OS:
Install the acl package on the running VM:
Save the information about permissions to VM files and directories:
Stop the VM:
If you use VMmanager 5 OVZ, stop the VM in the control panel: Management → Virtual machines → select the VM → Stop button.Comments to the command
109 — id of the OVZ container with the VM
Save the VM directory to the archive:
- Copy the created archive to LXD cluster node.
In the VMmanager interface, create a VM in the LXD cluster and stop it.
Create a VM with the same OS and the same parameters as the original VM.
Determine where the VM container is located:
Mount the container with the created VM:Comments to the command
tank — ZFS pool name
vm-624 — VM name
Clear the container:
Unzip the archive from the original VM:
Change the owner of the file system to the root user of LXD container:
Unmount the container:
Delete the content of the directory /var/snap/lxd/common/lxd/storage-pools/zfs_pool/containers/vm-624/.
Start the VM in VMmanager interface.
Restore the permissions to VM files:
Reboot the VM to apply the settings:
To enable VMmanager to change the VM network settings, install the cloud-int package: