Add prefix to [storage] section in config? #29

Closed
opened 2018-01-05 05:34:06 +00:00 by import_bot · 3 comments
Collaborator

I'm not seeing a place to specify the prefix for a borg archive. But the [retention] section has a 'prefix' section.

Maybe there should be a 'prefix' setting under [storage]? Or maybe the 'prefix' setting needs to be moved up from [retention] into the [storage] and used for both retention and archive name during a backup?

I'm leaning towards saying that 'prefix' should be the same for both creation of the backup archive and the pruning rules.

For backwards compatibility:

  • if only [storage] or [prune] has a prefix, use that value for both create/prune
  • if both [storage] and [prune] have prefix, use the value under [storage] for create and the value under [prune] for prune

https://github.com/witten/borgmatic/blob/master/borgmatic/config.py#L50

https://github.com/witten/borgmatic/blob/master/borgmatic/borg.py#L50


Imported from Taiga issue 28 (done). Created on 2017-04-10T12:24:20+0000 by Thomas Harold.

I'm not seeing a place to specify the prefix for a borg archive. But the [retention] section has a 'prefix' section. Maybe there should be a 'prefix' setting under [storage]? Or maybe the 'prefix' setting needs to be moved up from [retention] into the [storage] and used for both retention and archive name during a backup? I'm leaning towards saying that 'prefix' should be the same for both creation of the backup archive and the pruning rules. For backwards compatibility: - if only [storage] or [prune] has a prefix, use that value for both create/prune - if both [storage] and [prune] have prefix, use the value under [storage] for create and the value under [prune] for prune https://github.com/witten/borgmatic/blob/master/borgmatic/config.py#L50 https://github.com/witten/borgmatic/blob/master/borgmatic/borg.py#L50 --- Imported from Taiga issue 28 (done). Created on 2017-04-10T12:24:20+0000 by Thomas Harold.
Author
Collaborator

Hey Thomas,

Could you describe why you'd want a prefix option in "[storage]"? In other words, why doesn't the default prefix of "{hostname}-{timestamp}" work for your needs? Once I understand what you're trying to do, I can help figure out what the best solution is.

Thanks!


Comment on 2017-07-02T05:19:07+0000 by Dan Helfman.

Hey Thomas, Could you describe why you'd want a prefix option in "[storage]"? In other words, why doesn't the default prefix of "{hostname}-{timestamp}" work for your needs? Once I understand what you're trying to do, I can help figure out what the best solution is. Thanks! --- Comment on 2017-07-02T05:19:07+0000 by Dan Helfman.
Author
Collaborator

Right now, as I understand the code:

There is a "prefix" option under "[prune]", so that you can tell borgmatic to only prune archives with a specific prefix.  But because there's no way to specify a prefix during the creation of an archive, all archives get "{hostname}-{timestamp}" as their prefix.  So it's a bit odd that I can specify a prefix for [prune], but not one for [retention] or [consistency].

Thinking a bit more, maybe "prefix" needs to move up to "[storage]" and both [retention] and [consistency] sections need to use that value unless they have their own prefix defined.

The situation where this would matter is when you have two or more borg backups writing to the same repository and you only want the consistency checks to happen against one prefix (not all prefixes).

The other would be when you have two or more borgmatic "recipes", writing to the same repo, but with different source directory sets which need different retention requirements.  Because there's no "prefix" in the [storage] section, you can't override the "{hostname}" portion of the archive name with your own prefix (although I'd be happy with "{prefix}-{hostname}-{timestamp}").


Comment on 2017-07-03T13:39:51+0000 by Thomas Harold.

Right now, as I understand the code: There is a "prefix" option under "[prune]", so that you can tell borgmatic to only prune archives with a specific prefix.  But because there's no way to specify a prefix during the creation of an archive, all archives get "{hostname}-{timestamp}" as their prefix.  So it's a bit odd that I can specify a prefix for [prune], but not one for [retention] or [consistency]. Thinking a bit more, maybe "prefix" needs to move up to "[storage]" and both [retention] and [consistency] sections need to use that value unless they have their own prefix defined. The situation where this would matter is when you have two or more borg backups writing to the same repository and you only want the consistency checks to happen against one prefix (not all prefixes). The other would be when you have two or more borgmatic "recipes", writing to the same repo, but with different source directory sets which need different retention requirements.  Because there's no "prefix" in the [storage] section, you can't override the "{hostname}" portion of the archive name with your own prefix (although I'd be happy with "{prefix}-{hostname}-{timestamp}"). --- Comment on 2017-07-03T13:39:51+0000 by Thomas Harold.
Author
Collaborator

This is now implemented in the recently released borgmatic 1.1.7 thanks to this pull request: https://github.com/witten/borgmatic/pull/16

Basically, you can add an "archive_name_format" to the "storage" section containing the exact format and prefix you want using these placeholders: https://borgbackup.readthedocs.io/en/stable/usage.html#borg-help-placeholders


Comment on 2017-09-03T18:42:45+0000 by Dan Helfman.

This is now implemented in the recently released borgmatic 1.1.7 thanks to this pull request: https://github.com/witten/borgmatic/pull/16 Basically, you can add an "archive_name_format" to the "storage" section containing the exact format and prefix you want using these placeholders: https://borgbackup.readthedocs.io/en/stable/usage.html#borg-help-placeholders --- Comment on 2017-09-03T18:42:45+0000 by Dan Helfman.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#29
No description provided.