I’m using restic on a shared (b2) repository, with backups from all of my machines. One of the first snapshots was created by my old server, before I migrated to my new server. Sadly, both of them share the same hostname, which is why I now have a bunch of snapshots for it.
As I might need the old server’s snapshot in the near future, I’d like to protect it from my regular “forget” invocations. I already added a tag to this snapshot, but I guess that won’t help.
How can I run “forget” against the whole repository, but exclude a specific (tagged) snapshot? If this is not possible, what’s a good method to “copy” (recreate?) the snapshot?
When running restic forget, add the flag --keep-tag oldserver while replacing oldserver with the tag you added for the snapshot. That should do it and not interfere too much with the regular operation of restic forget. Please make sure to check the result using restic forget --dry-run! It’ll also tell you why each snapshot was kept.
There’s no ready-made built-in way to do that, but you could patch restic to create a new snapshot (it’s a short JSON document, like this) referencing the same tree object and timestamp, but with a different hostname. This way, restic forget will by default treat the snapshot separately from the others with the other hostname.