What is the best strategy for getting a consistent tarball from `incus export` on a running instance?

Doing a straight `incus export` on a running instance seems to be racy according to Some questions about incus storage volume export . Is this still true on Incus 7.0.1?

And if so: What is the best strategy to get a consistent tarball from a running instance? I think creating a snapshot of the running instance, copying the snapshot to a new instance of the same name in a different project, and exporting the (stopped) copy should be safe, but maybe there is an easier way? Directly exporting a single snapshot seems not to be supported by `incus export`.

The answer varies based on whether you’re dealing with a container or a VM and on what storage backend you’re running. Also whether optimized-storage is used as an export flag.

I want to be able to export all types of instances - containers (both OCI and system) and VMs. Storage backend is BTRFS in one deployment, Ceph in another, but that may change. But it will definitely be a storage backend that supports snapshots.

I won’t be using the ‘optimized-storage’ flag.

My intent is to have a backup for the whole system that stores the instance data in a format that I can us to

  • restore individual instances (and custom storage) in the running system
  • rebuild the system from scratch if necessary
  • and access the instance data manually at need

For the Incus configuration, I just back up the config in YAML format.

And for instance and storage volume data, plain tarballs (for containers and filesystem storage volumes) and tarballs containing disk images (for VMs or block storage volumes) is an acceptable compromise, because I can feed the full tarball back to `incus import` for the most common restore case (restore a single instance) and still have a more-or-less standard format to get at the data manually at need.

And I only need the current state at each export run because the (existing) backup system already does incremental versioning and deduplication (I’m using Borgbackup, and specifically `borg import-tar …` to get the tarballs into borg).