Support for multiple prefixes/archive/glob matchers? #599
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 multipel repos containing files for multiple different hosts and have named my archives within the repos on host names in reversed order. So host
foobar.example.org
became archive nameorg.example.foobar
, though, some of my real host names are much longer. Therefore I considered implementing a shorter naming scheme, e.g. likeex.foo
, which would still be unique enough in my cases.The problem is that BorgMatic seems to only maintain one prefix for operations like
prune
etc., so I would need to rename all available archives, which is a lot of work. Borg 2 introduced support for regular expressions, which would allow me to use|
in theory to support multiple different archvie names. But Borg 2 shouldn't be used in production yet and even if that changes at some point, one needs to transfer existing repos first. So I most likely not switch easily. Additionally, having one large regular expression with|
might be difficult to maintain as well.So from my point of view it would be great if BorgMatic would be able to support multiple prefixes and simply process one after another. In my case I don't even need different settings for prune, it's really only about the names. And I most likely wouldn't care too much as well if prune is actually executed multiple times one after another. For Borg 2, this might make handling multiple RE-matchers easier as well.
Any thoughts? Thanks!
Environment
borgmatic version: 1.6.1
borgmatic installation method: PIP, system wide
Borg version: 1.2.1
Python version: 3.8.10
operating system and version: Ubuntu 20.04
Generally, there's a convention that one borgmatic configuration file corresponds to one borgmatic invocation (per action). That convention isn't written in stone of course, but I am a little hesitant to add features that would be obviated by the eventual release of Borg 2 and its
--match-archives
feature. At the rate borgmatic feature development goes, Borg 2 might be used in production well before this or any other ticket makes it into a borgmatic release! #588 specifically is a feature to add amatch_archives
option (or options) to borgmatic configuration, so you would be able to use it very similiar toprefix
today.Alternatively, if you don't want to wait for Borg 2, you could make multiple different prune-only configuration files for borgmatic, one for each hostname. And then optionally you could use borgmatic includes so as to cut down on duplication.
I do wonder though: Why not prune all hosts at the same time with a single borgmatic/Borg invocation? In other words, why do you need to only prune the archives for a particular host instead of all hosts?
Let me know your thoughts!
Support for multiple prefixes/archive&glob matchers?to Support for multiple prefixes/archive/glob matchers?Different hosts are differently regularly backed up and need different prune settings because of space consumption and stuff. With the current approach, everything regarding one host is handled by one YAML file for that host, which I need anyway for its backup. If the host is not backed up anymore, either because of some error or for some special reason, it's not even pruned by accident too much. Otherwise I would need at least one additional prune YAML per repo, I need to consider the same for archive checks, as those aren't much different from pruning if pruning is outsourced etc. I currently like the lifecycle of checking+pruning+backing per host on each and every invocation pretty much.
But I get your point, might simply not be worth it. I am living with the "wrong" archive names for some time now already and most likely can longer. :-)
Hmm.. I think I'm not quite understanding your setup. If you already have one YAML file per host (which you need anyway for its backup, as you say), then doesn't borgmatic already support host-specific retention settings? For instance, in a given configuration file, you would have the all the backup and retention settings for that host—including a hard-coded host-specific retention
prefix
.Or are you saying that you'd ideally like to collapse all those settings for all hosts into a single configuration file?
Yes, but I need two of those prefixes when I change the naming scheme for archives for one and the same host.