ubuntu@lxc-host-r2:~/export$ lxc stop container
ubuntu@lxc-host-r2:~/export$ lxc export container container.tar
Error: Create backup: Backup create: Error adding "/var/snap/lxd/common/lxd/storage-pools/zfspool/backup.501085870/rootfs/home/ubuntu/random-file" as "backup/container/rootfs/home/ubuntu/random-file" to tarball: Failed to copy file content "/var/snap/lxd/common/lxd/storage-pools/zfspool/backup.501085870/rootfs/home/ubuntu/random-file": io: read/write on closed pipe
The random-file here is a stand-in name for a file in the container’s file system. Exporting fails at a different file each time. Looking inside the containers, there is really nothing special about the files. They are all owned by a regular system user (“ubuntu” typically), are not corrupted, or otherwise conspicuous.
There is plenty of disk space available at the destination directory (also ZFS).
You could be running out of disk space on the root partition where LXD runs. This is used as an intermediate holding area to generate the tarball before its streamed to the target file on the client.
You could try creating a custom volume on one of your storage pools and then specifying that LXD use that for the intermediate holding area.
It depends what storage pool you’re using for your backup volume (note it doesn’t need to be the same as the one your exporting the instance from) and whether it always requires a volume size (or if the default volume size of 10GB is sufficient for those that do).
By default ZFS, BTRFS and DIR storage pools don’t enforce a volume size limit, whereas LVM and CEPH always require one (because each volume is blocked storage backed).
You could create a dir storage pool at a custom location to use for backups, e.g.
lxc storage create backup dir source=/some/path/with/plenty/of/space
lxc storage create backup backupvol
lxc config set storage.backups_volume=backup/backupvol