Lxc export behavior

You can create just a snapshot on the storage pool using lxc snapshot <instance>.

The lxc export command is designed to produce a storage-pool agnostic backup of the instance.
You can also specify a target file so that the backup is immediately downloaded and then removed from the server.

This is different from lxd recover which is about recovering metadata from the storage pool if the LXD DB is damaged/removed.

The temporary storage location needed for creating the backup tarball can be changed by setting the storage.backups_volume key, e.g. lxc config set storage.backups_volume=<pool/volume> to an existing custom storage volume (can be on a different storage pool). See Server settings | LXD

The reason streaming of the temporary file isn’t supported is:

  • It may cause large memory spikes by the tools used to create the tarball buffering in memory if the network doesn’t keep up.
  • The tarball format requires having the entire file to add to the tarball ready (rather than streamed in), and in the case of optimized backups (these are blobs from supported storage pools) these are not known until the temporary file has been created (for non-optimized backups the volume is mounted and each file is added individually rather than copying the entire volume first).

Some storage pools support cheap snapshots, in those cases the export process will take a temporary snapshot and then delete it.

As you’re using LVM, you could potentially take a normal snapshot using lxc snapshot and then use the LVM volume directly (activating it if the instance isn’t running) and then either accessing the block device directly or mounting it somewhere else and streaming the filesystem contents elsewhere.