(Exclude) patterns having no effect at all (Borgmatic 2.0.10) #1169
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1169
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I want to exclude parts of a Btrfs-volume from the backup and my trouble-shooting efforts have lead me back to base zero where I am trying to exclude everything.
Steps to reproduce
In the config file, I have source_directories, repositories and
Actual behavior
Each and every file and folder of the volume is backed up.
I have run Borgmatic with the flags
-v2 --listand attached the output (reduced by the bulk of content files). Previous runs that got interrupted left stale snapshots that are deleted first. However, there is no difference in behavior even after a cleanly terminated run.Expected behavior
No file or folder should be backed up.
Other notes / implementation ideas
Originally I wanted to split the backup of a LXC-container into two parts and have the data folders backed-up separately.
borgmatic version
2.0.10
borgmatic installation method
pipx
Borg version
borg 1.4.1
Python version
Python 3.12.3
Database version (if applicable)
No response
Operating system and version
Ubuntu 24.04.3 LTS
I have a pretty good idea what's going on here. To address #1150 and specifically a user's global exclude inadvertently excluding the borgmatic runtime directory and Btrfs snapshot paths (among other things), borgmatic now more aggressively "punches through" such excludes by doing an explicit include of the Btrfs snapshot path first.
The problem with that strategy, as you've apparently discovered, is that it also overrides any intentional user excludes of portions of the snapshot path.
So can I get an example of the non-global partial snapshot path exclude you were doing initially (redacted as necessary) + corresponding debug logs? At this point, I have no idea what a solution might be that doesn't break the inadvertent global exclude case, but I can noodle on it and see what I can come up with.
Many thanks, @witten, for your quick reply which makes perfect sense. Would you be OK with me sending you the config and (abbreviated) log files via private message? It is probably best to see it all unredacted but I do not want to make them publicly available.
Yup, that's totally fine. You can email me or if you prefer message me (witten) on IRC.
FYI I do have a repro here, but I want to make sure it's a representative repro of your use case.
Okay, I've pushed a fix to main, which will be part of the next release. The solution I went with was making sure that any snapshot include patterns that borgmatic inserts get inserted into the user's patterns after any partial exclude patterns for the snapshot path (but still before any global exclude patterns).
Thanks for bringing this to my attention!
Great, thanks a lot for taking care of this issue! I am awaiting the upcoming release to test out the fix.
Not worth a ticket of its own because it is mostly a wish: could you please include (: some explanation about the role of the recursion root for patterns in the configuration documentation? AFAICT that is the only place where
Rappears and it is unclear (to me at least) what its role is even after reading through the output of "borg help patterns" and related documentation by Borg.Many thanks for providing this valuable application!
I took a stab at that here:
Let me know if you have any feedback on it.
(This is a copy of my direct response via e-mail to the notification. Sorry for that out-of-band communication! Maybe the link below can be helpful to others searching for further explanations.)
Aaaha, now I got it! Thanks for explaining. The take-away for me is that I do not have to worry about it with Borgmatic because it is already set, right?
Would it make sense to add this statement? In the current state with the example following below it looks like one would need to set the recursion root anyways.
The real problem was that the output of
borg help patternswas not very clear to me. With a bit of research, however, one finds an instructional explanation by Thomas Waldmann. So in combination this should suffice for getting anybody started well.Thanks for your consideration.
FYI I don't think incoming email processing is currently enabled here. Maybe it should be...
Depends. Do you have the "roots" set in
source_directories? If so, then yes, they are already set. But if you omit them fromsource_directories, then they'll need to be listed inpatternsas recursion roots.Which statement? The bit about the recursion roots already being set? I'm happy to clarify the docs.. I just want to clarify what exactly I'd be clarifying. π
Yeah, that explanation is helpful. Maybe borgmatic could benefit from its own reference documentation page on patterns.
Err, I was speaking of the above statement that the recursion root does not need to be set explicitly -- which turns out to be false as you say. π
Together with the explanation by Thomas Waldmann I believe I am starting to understand how things should work. I shall wait for the next release and tinker with the exclude patterns. Once I get my head around all these things, I will be able to formulate more clearly what would have helped me now. π
Okay, please feel free to file subsequent tickets for documentation or other improvements.. The only way I find out about things that are unclear are when I hear about them from users like you!