Incus and restic

I wrote a simple script to backup one incus instance with restic:

#!/bin/sh
POOL=/var/lib/incus/storage-pools/default

if [ "x$2" = "x" ]
then
  echo "usage: incus-backup <instance> <target>"
  exit 1
fi

. /backup/.secret.$2 

INSTANCE=$1

cd $POOL
if [ -d containers/$INSTANCE ]
then
  echo "$INSTANCE is container"
  SUB=containers
elif [ -d virtual-machines/$INSTANCE ]
then
  echo "$INSTANCE is virtual machine"
  SUB=virtual-machines
else
  echo "not found"
  exit 2
fi

incus snapshot create $INSTANCE backup.$$

proot -b $POOL/${SUB}-snapshots/$INSTANCE/backup.$$:/$SUB/$INSTANCE \
		restic backup --one-file-system /$SUB/$INSTANCE 

incus snapshot delete $INSTANCE backup.$$

Basically it create a new snapshot of the instance and send this snapshot to restic.

So far, this works fine.

Recovery is then a simple

restic restore <ID> --target $POOL

In case of a total system crash and restoring to a fresh system, this just restore the directories/files in the storage pool. So I need an

incus admin recover

And here is my problem/question.

If there are snapshots present, all the snapshots are listed in the backup.yaml and the recover fails, since in the fresh system the snapshots are not there. I now know, how to remove the snapshots from the backup.yaml manually, but in a desater recovery situation I do not want to do this operations on all the instances by hand.

Is there the possibillity to add a parameter like “–instance-only” to the recover command ?

Thanks,

Patrick