Question: Why is /root/.borgmatic being backed up? #638
Loadingโฆ
x
Reference in New Issue
Block a user
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 have a working borg backup setup but I noticed recently during manual extraction of archive that files in the
are included in it.
I was not aware of this and could not find information about it on borg / borgmatic wikis so I end up posting an issue about it. I feel like the reason behind it should be obvious since I think this is related to checks being enabled on the repository. The files that are being backed up are in /root/.borgmatic/checks directory, but it doesn't match my inclusion/exclusion patterns and I wanted to be sure that this behavior is intended.
Steps to reproduce (if a bug)
config.yaml:
Actual behavior (if a bug)
When running borgmatic --dry-run --list with the above config I see following lines in the output
Environment
borgmatic version: 1.7.6
Borg version: 1.2.3
Python version: 3.11.1
Thanks for taking the time to file this including all the details about your setup! The short answer as to why
~/.borgmatic
is being backed up is that doing so directly supports database dump backups. Each database dump is streamed from your database to a special named pipe within~/.borgmatic
and from there it goes directly to Borg without taking up any temporary space on disk.This "feature" is documented on the database backup page, but maybe it needs to be made more prominent. And as a side effect, it backs up
~/.borgmatic/checks
as well. Which isn't the worst thing, because it means your check state gets backed up as well. (But it is an implicit side effect, which maybe isn't so great.)So, to answer your question: It is intended behavior. But I'm still open to making improvements to it!
So I think now the question is - is it a good thing to include
~/.borgmatic/checks
just because they happen to share a common directory with the named pipe for the databases.I can think of scenarios where backing up the check states is desired but I think it shouldn't be done automatically without the user knowledge. At least to avoid confusion like in my case.
If you agree then I think the solution would be to simply include
~/.borgmatic/*/db/*
instead of~/.borgmatic/*
. What do you think?Edit: There is a really simple workaround for this if you think the behavior is not worth changing. If you don't want to have check states backed up you can exclude
~/.borgmatic/checks/*
in the config but I still think that the "check states being backed up when database hooks are enabled" behavior should be documented somewhere.Changing this to avoid implicitly backing up the check state makes sense to me.
This is implemented in main and will be part of the next release!
~/.borgmatic/checks
is moving to~/.local/state/borgmatic/checks
by default, but you can override it by setting a newborgmatic_state_directory
option or even via the $XDG_STATE_HOME environment variable. See #562 for some of the rationale for this particular location.