I am setting up some restic repos for the first time, and I was surprised by some of the behavior of exclusion vs. inclusion.
Here is the scenario, I have a directory
samples-files that contains 3 directories sample directories. In both cases, I want to start with 2 of the directories included, and then add in all directories.
restic -r b2:<testing-repo>:exclude backup --verbose sample-files/ --exclude sample-files/sample1/
restic -r b2:<testing-repo>:include backup --verbose sample-files/sample2/ sample-files/sample3/
(in my real use case I was using the
files-from option, but my understanding is they are basically the same behavior)
At this point, these repos are the same. What changes is when I add in the missing directory and point the next backup to
sample-files with no inclusion or exclusion.
What I see then is two snapshots in both repos, when I go to clean up both repos with
restic forget -r b2:<testing-repo>:<repo-name> --keep-daily 1 the excluded repo forgets all by 1 snapshot, whereas the repo created by the include method, which has different paths, keeps both snapshots around.
My current use case is I am selectively deciding what files to include as I have a lot of junk on my NAS. It is far easier to take a whitelist approach and include files than it is to exclude, due to the amount of data. The issue is that snapshots stick around post forget operations since the path is changed as I add additional files. I can go in and manually clean up the snapshots, but that is less than ideal.
TLDR: Is there a way to selective include files but keep a single path so that snapshots get forgotten properly?