i take a export from my lxd: (from ubuntu 18.04 with snap installation of lxc version 3.19 and using zsf)
lxc publish CONTAINER_NAME --alias my-lxd
lxc image export my-lxd .
then move tarball to my new server (ubuntu 18.04.3 default lxc (version 3.0.3installation using zfs )
lxc image import bxxxx.tar.gz --alias my-lxd
then i try to create a new-lxd-name with command
lxc init my-lxd new-lxd-name
UNIQUE constraint failed: storage_volumes.storage_pool_id, storage_volumes.node_id, storage_volumes.name, storage_volumes.type
HELP
Looking at LXD go code for export/import, it's highly unlikely this will ever work or will ever be fixed to work... because...
1) Trying take an export image of a ZFS container references machine unique ZFS data which only lives on source machine.
So exports will work + imports will fail... at least... that's my read...
2) Instead of an export/import, get your new/target container working using EXT4 or ZFS or whatever.
3) Then stop your old/source container + new/target container.
4) Then just rsync over all the files required from old/source container -> new/target. This includes /var/lib/mysql, /var/log/mysql (if bin logging is used), /etc/apache2/* + /etc/php/* + /etc/letsencrypt/* + any other files of interest.
5) On new/target container, ensure all your file ownership is correct.
6) Start your new/target container + all should be well.
Note: In my situation, I clone/copy/move containers, many containers/day, so all these LXD commands must work for me.
I've learned by many lost hours, if you're doing clone/copy/move frequently, stick with EXT4 as your backing store.
You'll do this via an init sequence of...
Open in new window