VMmanager 6: Administrator guide

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:

  1. Save the information about permissions to VM files.
  2. Create an LXD container for the VM and clear it.
  3. Move the directory of the source VM to the created LXD container.
  4. Restore the permissions to VM files.

Example of moving a VM for Debian and Ubuntu OS:

  1. Install the acl package on the running VM:

    apt install acl
  2.  Save the information about permissions to VM files and directories:

    cd / && getfacl -R / > acl.save
  3. Stop the VM:


    If you use VMmanager 5 OVZ, stop the VM in the control panel: ManagementVirtual machines → select the VM → Stop button.

    vzctl stop 109
     Comments to the command

    109 — id of the OVZ container with the VM

  4. Save the VM directory to the archive:

    If you use simfs
    cd /vz/private/109/;tar -czf /109.tgz
    If you use ploop
    mount -t ploop /vz/private/109/root.hdd/DiskDescriptor.xml /media/;cd /media;tar -czf /109.tgz
  5. Copy the created archive to LXD cluster node.
  6.  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.

  7. Determine where the VM container is located:

    zfs list
  8. Mount the container with the created VM:

    zfs mount tank/containers/vm-624
     Comments to the command

    tank — ZFS pool name

    vm-624 — VM name

  9. Clear the container:

    rm -rf /var/snap/lxd/common/lxd/storage-pools/zfs_pool/containers/vm-624/rootfs/*
  10. Unzip the archive from the original VM:

    tar -xf 109.tgz -C /var/snap/lxd/common/lxd/storage-pools/zfs_pool/containers/vm-624/rootfs
  11. Change the owner of the file system to the root user of LXD container:

    chown 1000000:1000000 /var/snap/lxd/common/lxd/storage-pools/zfs_pool/containers/vm-624/rootfs/ -R
  12. Unmount the container:

    zfs umount tank/containers/vm-624
  13. Delete the content of the directory /var/snap/lxd/common/lxd/storage-pools/zfs_pool/containers/vm-624/.

  14. Start the VM in VMmanager interface.

  15. Restore the permissions to VM files:

    lxc exec vm-624 bash
    cd / && setfacl --restore=acl.save
  16. Reboot the VM to apply the settings:

  17. To enable VMmanager to change the VM network settings, install the cloud-int package:

    lxc exec vm-624 bash
    Command for Debian 9 OS
    curl -O https://download.ispsystem.com/external/cloud-init/stretch/cloud-guest-util_0.29-1_all.deb -O https://download.ispsystem.com/external/cloud-init/stretch/cloud-image-utils_0.29-1_all.deb -O https://download.ispsystem.com/external/cloud-init/stretch/cloud-init_20.2-2~deb10u1_all.deb -O https://download.ispsystem.com/external/cloud-init/stretch/cloud-utils-euca_0.29-1_all.deb -O https://download.ispsystem.com/external/cloud-init/stretch/cloud-utils_0.29-1_all.deb && dpkg -i cloud-init*
    Command for other OS
    apt install cloud-int