Instance and added Volume copy/backup/migration with Mountpoint

How would I copy/backup/migrate an instance and a volume at a crucial location inisde the instance to another server?

My setup, thanks to your help as of now is:

lxc storage create container-pool zfs source=zfs/container-pool
zfs set quota=336g zfs/container-pool  ### absolute total for the whole pool
lxc storage volume create container-pool mysql-volume
zfs set recordsize=16k zfs/container-pool/custom/zfs_mysql-volume
lxc init ubuntu:20.04 container-name -s container-pool
lxc config device add container-name mysql-disk disk pool=container-pool source=mysql-volume path=/var/lib/mysql
lxc start container-name

When I run

lxc copy container-name remote:container-name -s remote-pool & \
lxc storage volume copy container-pool/mysql-volume remote:remote-pool/mysql-volume

will

  1. both stores be snapshotted and transfered, or frozen and then transfered? And if they are frozen how do I do it without downtime of the instance?
  2. any snapshots that are already there also be copied over?
  3. the transfer be optimized?
  4. the mount of the mysql-volume be in tact on the instance on the remote server? If no how do I make it so?
  5. the ZFS preferences like recordszie=16k be in tact on the remote server?

Thanks in advance!

  1. LXD will create a temporary snapshot and transfer everything up to that snapshot. No freezing happens as ZFS snapshots are atomic.
  2. Yeah, unless you pass --instance-only, snapshots are included
  3. Yes, if both source and target pools are on ZFS, zfs send/receive is used
  4. The disk device is part of the instance config which is copied on the target, so long as the pools are named the same way, this should all work fine
  5. Properties set directly on a dataset are included in send/receive so should make it to the target
1 Like

Thank you so much Stéphane!! :slight_smile:

When playing around locally I noticed that copying an instance from one ZFS pool to another seemed to be very slow (20-30MB/s) and using rsync, is that expected behavior @stgraber?