Whitelisting paths in a snaphsot

I currently use a script in a timer that:

  1. Create LVM snapshots
  2. mount the snapshots under /tmp/restic
  3. run restic under proot mapping the /tmp/restic/$name back to the original locations, backing up those locations and some that I currently do not snapshot first, but sill excluding everything else
  4. clean up

Sadly, this causes snapshots to pile that have different path fields as I add services to backup.

I also do not want to explicitely maintain a blacklist, but want to keep it as a “whitelist”, though I’d prefer if I generally would see “/var/lib” as path, regardless of the whitelisted subfolders I actuallly care to back up.

As I know that I will not be able to change the old path entries, I’d like to get this nice now, before the number of “legacy” backups becomes too large.

I have seen that there is --files-from-verbatim, though its documentation is not clear whether it works as I need it, or if it actually doesn’t change anything, so before rewriting my scripts to make use of that, I wanted to know whether it will actually work how I want it.

Thank you in advance!

I was able to test it now and --files-from-verbatim still “explodes” the paths of a snapshot.

I’d really be happy if there was a way to backup /var/lib but only goodlisted subfolders. I do not want to have to maintain an ignore list manually.

I’m not sure, but isn’t there an --include option which you could combine with excludes?

BTW, rustic uses glob patterns for excluding/including files, so this glob-file should do what you want:

# ...

Yeah, I found something in the manual yesterday. I have not been able to test yet.

Idea was an exclude list like this:


To backup nothing but the downloads folder.