I had a tag I manually added disappear after a backup. Is this a bug? Am I using restic wrong? (I haven’t used tags much before)
First, I added the tag:
$ restic snapshot
<...>
8b867a93 2024-10-07 16:42:28 macaw.local /Users/ilyagr 6.257 GiB
/etc
/private/etc
$ restic tag 8b867a93 --add wasteful
create exclusive lock for repository
repository e04784bb opened (version 2, compression level auto)
modified tags on 1 snapshots
$ restic snapsots
<...>
4a4eafd0 2024-10-07 16:42:28 macaw.local wasteful /Users/ilyagr 6.257 GiB
/etc
/private/etc
So far, all is OK. The snapshot id changed, but that is expected (as I was just surprised to learn after browsing the forum). Now, I do a backup:
$ restic backup ... # Nothing about tags here
open repository
repository e04784bb opened (version 2, compression level auto)
using parent snapshot 8b867a93
load index files
<...>
This seems problematic already. Note the “using parent snapshot 8b867a93” line: it’s using the id from before the tag was added. Now, the older snapshot again has the id 8b867a93 and no tag:
$ restic snapshots # Shows the old snapshot without tag and the new one we just made
<...>
8b867a93 2024-10-07 16:42:28 macaw.local /Users/ilyagr 6.257 GiB
/etc
/private/etc
0d58b414 2024-10-08 18:38:55 macaw.local /Users/ilyagr 6.271 GiB
/etc
/private/etc
How do I add a tag so that it stays?
I’m using restic 0.17.1 compiled with go1.22.7 on darwin/arm64.
Update: Assuming the tag --add
operation is meant to create a new snapshot 4a4eafd0 and delete the old snapshot 8b867a93, would this be what happens if the deletion is somehow prevented? I was copying the restic repo at the time to another dir, maybe the cp
command prevented the deletion of the old snapshot by opening its file somehow and by a very unlikely coincidence.