Overriding check_last when running borgmatic check --only archives #534

Closed
opened 2022-05-16 06:34:23 +00:00 by trisager · 3 comments

What I'm trying to do and why

I am trying to run a manual consistency check of all archives in two repositories.

The config files have check_last: 3 in the consistency sections. The manual consistency check is intended to be run on demand, and should check all archives, not just the three latest.

Steps to reproduce (if a bug)

Create a config file with check_last: 3.

Run borgmatic check --only archives

Actual behavior (if a bug)

The check only verifies consistency of the last three arcives;

# borgmatic check --only archives -v 2

Ensuring legacy configuration is upgraded
borg --version --debug --show-rc
/etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function initialize_monitor
/etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function ping_monitor
/etc/borgmatic.d/borgbase.yaml: Pinging Healthchecks start
/etc/borgmatic.d/borgbase.yaml: Using Healthchecks ping URL https://redacted/start
/etc/borgmatic.d/borgbase.yaml: No commands to run for pre-check hook
redacted:repo: Running consistency checks
borg check --archives-only --last 3 --prefix {hostname}- --debug --show-rc redacted:repo
using builtin fallback logging configuration
38 self tests completed in 0.07 seconds
SSH command line: ['ssh', 'redacted', 'borg', 'serve', '--debug']
Remote: using builtin fallback logging configuration
Remote: borg selftest disabled via BORG_SELFTEST env variable
Remote: using builtin fallback logging configuration
Remote: Initialized logging system for JSON-based protocol
Remote: Resolving repository path b'repo'
Remote: Resolved repository path to '/srv/repos/redacted/repo'
Starting archive consistency check...
Remote: Verified integrity of /srv/repos/redacted/repo/index.112
TAM-verified manifest
Analyzing archive redacted (1/3)
Analyzing archive redacted (2/3)
Analyzing archive redacted (3/3)
RepositoryCache: current items 17, size 741.21 kB / 2.15 GB, 19 hits, 17 misses, 0 slow misses (+0.0s), 0 evictions, 0 ENOSPC hit

Orphaned objects check skipped (needs all archives checked).

Archive consistency check complete, no problems found.
RemoteRepository: 1.50 kB bytes sent, 989.61 kB bytes received, 31 messages sent
terminating with success status, rc 0
/etc/borgmatic.d/borgbase.yaml: No commands to run for post-check hook
/etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function ping_monitor
/etc/borgmatic.d/borgbase.yaml: Pinging Healthchecks finish
/etc/borgmatic.d/borgbase.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted
/etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function destroy_monitor
borg --version --debug --show-rc
/etc/borgmatic.d/oba.yaml: Calling healthchecks hook function initialize_monitor
/etc/borgmatic.d/oba.yaml: Calling healthchecks hook function ping_monitor
/etc/borgmatic.d/oba.yaml: Pinging Healthchecks start
/etc/borgmatic.d/oba.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted/start
/etc/borgmatic.d/oba.yaml: No commands to run for pre-check hook
redacted: Running consistency checks
borg check --archives-only --last 3 --prefix {hostname}- --debug --show-rc redacted:backups
using builtin fallback logging configuration
38 self tests completed in 0.08 seconds
SSH command line: ['ssh', 'redacted', 'borg', 'serve', '--debug']
Remote: using builtin fallback logging configuration
Remote: 38 self tests completed in 0.11 seconds
Remote: using builtin fallback logging configuration
Remote: Initialized logging system for JSON-based protocol
Remote: Resolving repository path b'backups'
Remote: Resolved repository path to 'redacted'
Starting archive consistency check...
Remote: Verified integrity of redacted/index.423
TAM-verified manifest
Analyzing archive redacted (1/3)
Analyzing archive redacted (2/3)
Analyzing archive redacted (3/3)
RepositoryCache: current items 16, size 908.02 kB / 2.15 GB, 20 hits, 16 misses, 0 slow misses (+0.0s), 0 evictions, 0 ENOSPC hit

Orphaned objects check skipped (needs all archives checked).

Archive consistency check complete, no problems found.
RemoteRepository: 1.46 kB bytes sent, 1.17 MB bytes received, 30 messages sent
terminating with success status, rc 0
/etc/borgmatic.d/oba.yaml: No commands to run for post-check hook
/etc/borgmatic.d/oba.yaml: Calling healthchecks hook function ping_monitor
/etc/borgmatic.d/oba.yaml: Pinging Healthchecks finish
/etc/borgmatic.d/oba.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted
/etc/borgmatic.d/oba.yaml: Calling healthchecks hook function destroy_monitor

summary:
/etc/borgmatic.d/borgbase.yaml: Successfully ran configuration file
/etc/borgmatic.d/oba.yaml: Successfully ran configuration file

Expected behavior (if a bug)

The check should verify the integrity of all archives, disregarding the check_last: 3 line in the config file

Other notes / implementation ideas

Add to documentation if this is intentional (or won't be fixed).

The documentation could describe how to run this using an arbitrary borg command.

Environment

borgmatic version: 1.6.0

borgmatic installation method: sudo pip3 install --user --upgrade borgmatic

Borg version: 1.2.0

Python version: 3.8.10

Database version (if applicable): Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

operating system and version: Description: Ubuntu 20.04.4 LTS

#### What I'm trying to do and why I am trying to run a manual consistency check of all archives in two repositories. The config files have `check_last: 3` in the consistency sections. The manual consistency check is intended to be run on demand, and should check all archives, not just the three latest. #### Steps to reproduce (if a bug) Create a config file with `check_last: 3`. Run `borgmatic check --only archives` #### Actual behavior (if a bug) The check only verifies consistency of the last three arcives; ``` # borgmatic check --only archives -v 2 Ensuring legacy configuration is upgraded borg --version --debug --show-rc /etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function initialize_monitor /etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function ping_monitor /etc/borgmatic.d/borgbase.yaml: Pinging Healthchecks start /etc/borgmatic.d/borgbase.yaml: Using Healthchecks ping URL https://redacted/start /etc/borgmatic.d/borgbase.yaml: No commands to run for pre-check hook redacted:repo: Running consistency checks borg check --archives-only --last 3 --prefix {hostname}- --debug --show-rc redacted:repo using builtin fallback logging configuration 38 self tests completed in 0.07 seconds SSH command line: ['ssh', 'redacted', 'borg', 'serve', '--debug'] Remote: using builtin fallback logging configuration Remote: borg selftest disabled via BORG_SELFTEST env variable Remote: using builtin fallback logging configuration Remote: Initialized logging system for JSON-based protocol Remote: Resolving repository path b'repo' Remote: Resolved repository path to '/srv/repos/redacted/repo' Starting archive consistency check... Remote: Verified integrity of /srv/repos/redacted/repo/index.112 TAM-verified manifest Analyzing archive redacted (1/3) Analyzing archive redacted (2/3) Analyzing archive redacted (3/3) RepositoryCache: current items 17, size 741.21 kB / 2.15 GB, 19 hits, 17 misses, 0 slow misses (+0.0s), 0 evictions, 0 ENOSPC hit Orphaned objects check skipped (needs all archives checked). Archive consistency check complete, no problems found. RemoteRepository: 1.50 kB bytes sent, 989.61 kB bytes received, 31 messages sent terminating with success status, rc 0 /etc/borgmatic.d/borgbase.yaml: No commands to run for post-check hook /etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function ping_monitor /etc/borgmatic.d/borgbase.yaml: Pinging Healthchecks finish /etc/borgmatic.d/borgbase.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted /etc/borgmatic.d/borgbase.yaml: Calling healthchecks hook function destroy_monitor borg --version --debug --show-rc /etc/borgmatic.d/oba.yaml: Calling healthchecks hook function initialize_monitor /etc/borgmatic.d/oba.yaml: Calling healthchecks hook function ping_monitor /etc/borgmatic.d/oba.yaml: Pinging Healthchecks start /etc/borgmatic.d/oba.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted/start /etc/borgmatic.d/oba.yaml: No commands to run for pre-check hook redacted: Running consistency checks borg check --archives-only --last 3 --prefix {hostname}- --debug --show-rc redacted:backups using builtin fallback logging configuration 38 self tests completed in 0.08 seconds SSH command line: ['ssh', 'redacted', 'borg', 'serve', '--debug'] Remote: using builtin fallback logging configuration Remote: 38 self tests completed in 0.11 seconds Remote: using builtin fallback logging configuration Remote: Initialized logging system for JSON-based protocol Remote: Resolving repository path b'backups' Remote: Resolved repository path to 'redacted' Starting archive consistency check... Remote: Verified integrity of redacted/index.423 TAM-verified manifest Analyzing archive redacted (1/3) Analyzing archive redacted (2/3) Analyzing archive redacted (3/3) RepositoryCache: current items 16, size 908.02 kB / 2.15 GB, 20 hits, 16 misses, 0 slow misses (+0.0s), 0 evictions, 0 ENOSPC hit Orphaned objects check skipped (needs all archives checked). Archive consistency check complete, no problems found. RemoteRepository: 1.46 kB bytes sent, 1.17 MB bytes received, 30 messages sent terminating with success status, rc 0 /etc/borgmatic.d/oba.yaml: No commands to run for post-check hook /etc/borgmatic.d/oba.yaml: Calling healthchecks hook function ping_monitor /etc/borgmatic.d/oba.yaml: Pinging Healthchecks finish /etc/borgmatic.d/oba.yaml: Using Healthchecks ping URL https://hc-ping.com/redacted /etc/borgmatic.d/oba.yaml: Calling healthchecks hook function destroy_monitor summary: /etc/borgmatic.d/borgbase.yaml: Successfully ran configuration file /etc/borgmatic.d/oba.yaml: Successfully ran configuration file ``` #### Expected behavior (if a bug) The check should verify the integrity of all archives, disregarding the `check_last: 3` line in the config file #### Other notes / implementation ideas Add to documentation if this is intentional (or won't be fixed). The documentation could describe how to run this using an arbitrary borg command. #### Environment **borgmatic version:** 1.6.0 **borgmatic installation method:** `sudo pip3 install --user --upgrade borgmatic` **Borg version:** 1.2.0 **Python version:** 3.8.10 **Database version (if applicable):** Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 **operating system and version:** Description: Ubuntu 20.04.4 LTS
Owner

Thanks for filing the ticket! The behavior you're seeing is actually by design. borgmatic runs your requested action (e.g. check) with all the configured options in borgmatic's configuration file so that you don't have to re-specify them. However, in this case, if you really want to override the check_last option, there is a way to do that! Try this:

borgmatic check --only archives --override consistency.check_last=0

The --override flag allows you to override arbitrary configuration file options on the command-line.

The documentation could describe how to run this using an arbitrary borg command.

It does! See this how-to and let me know if it meets your needs.

Thanks for filing the ticket! The behavior you're seeing is actually by design. borgmatic runs your requested action (e.g. `check`) with all the configured options in borgmatic's configuration file so that you don't have to re-specify them. However, in this case, if you really want to override the `check_last` option, there is a way to do that! Try this: ``` borgmatic check --only archives --override consistency.check_last=0 ``` The [`--override` flag](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#configuration-overrides) allows you to override arbitrary configuration file options on the command-line. > The documentation could describe how to run this using an arbitrary borg command. It does! [See this how-to](https://torsion.org/borgmatic/docs/how-to/run-arbitrary-borg-commands/) and let me know if it meets your needs.
Author

Thanks! I had missed the --override flag, perfect.

Thanks! I had missed the `--override` flag, perfect.
Owner

Glad to hear it might work for you! If it turns out it doesn't for whatever reason, please let me know.

Glad to hear it might work for you! If it turns out it doesn't for whatever reason, please let me know.
witten added the
question / support
label 2022-05-17 04:42:40 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 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#534
No description provided.