OK so I can see the issue and its not quite the same as what was fixed in LXD 5.3.
An instance snapshot is made up of 3 things:
- An instance snapshot DB record (these are show in the output of
lxc info <instance>
). - A storage volume snapshot DB record (these are shown in the output of
lxc storage volume show <pool>
). - The actual snapshot volume on disk.
In this case the state of 3. (zfs list
) is irrelevant as the error is only complaining about inconsistencies between 1 and 2.
In the scenario that was fixed in LXD 5.3, if there is an instance snapshot DB record (1.) but no associated storage volume snapshot DB record (2.) then LXD will now auto-create the missing storage volume snapshot DB record (as in most cases these records don’t contain any custom config and so can be re-crearted effectively).
However in your case you have 3 instance snapshot DB records:
after-upgrade-ubuntu-20.04
snap1
snap2
But you have additional storage volume snapshot DB records:
after-2019-10-20-system-updates
after-nextcloud-config
before-2019-11-14-updates
snap0
snap3
snap4
It is this inconsistency that LXD is now validating before allowing a fresh config backup to be made.
Now, we can’t automatically create an associated instance snapshot DB record for these excess storage volume snapshot DB records, nor would we want to delete them (or any associated snapshots on disk) for fear of causing data loss.
So in this case it will need manual intervention to delete these records.
You can use this command to get a list of all storage volume snapshot records:
lxd sql global 'select storage_volumes.name, storage_volumes_snapshots.* from storage_volumes_snapshots join storage_volumes on storage_volumes_snapshots.storage_volume_id = storage_volumes.id'
Then you can run:
lxd sql global 'delete from storage_volumes_snapshots where id = <ID of snapshot to delete>'