2019-02-04 07:20:59 +01:00
|
|
|
---
|
|
|
|
title: How to deal with very large backups
|
2020-08-21 23:27:47 +02:00
|
|
|
eleventyNavigation:
|
2022-05-20 20:11:35 +02:00
|
|
|
key: 📏 Deal with very large backups
|
2020-08-21 23:27:47 +02:00
|
|
|
parent: How-to guides
|
2022-06-17 00:30:53 +02:00
|
|
|
order: 4
|
2019-02-04 07:20:59 +01:00
|
|
|
---
|
|
|
|
## Biggish data
|
|
|
|
|
|
|
|
Borg itself is great for efficiently de-duplicating data across successive
|
2019-02-05 05:58:27 +01:00
|
|
|
backup archives, even when dealing with very large repositories. But you may
|
2023-03-08 23:05:06 +01:00
|
|
|
find that while borgmatic's default actions of `create`, `prune`, `compact`,
|
|
|
|
and `check` works well on small repositories, it's not so great on larger
|
|
|
|
ones. That's because running the default pruning, compact, and consistency
|
|
|
|
checks take a long time on large repositories.
|
|
|
|
|
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.7.9</span> The
|
|
|
|
default action ordering was `prune`, `compact`, `create`, and `check`.
|
2019-02-04 07:20:59 +01:00
|
|
|
|
|
|
|
### A la carte actions
|
|
|
|
|
2023-03-08 23:05:06 +01:00
|
|
|
If you find yourself wanting to customize the actions, you have some options.
|
|
|
|
First, you can run borgmatic's `prune`, `compact`, `create`, or `check`
|
|
|
|
actions separately. For instance, the following optional actions are
|
|
|
|
available (among others):
|
2019-02-04 07:20:59 +01:00
|
|
|
|
|
|
|
```bash
|
2023-03-08 23:05:06 +01:00
|
|
|
borgmatic create
|
2019-06-23 07:09:50 +02:00
|
|
|
borgmatic prune
|
2022-02-09 23:33:12 +01:00
|
|
|
borgmatic compact
|
2019-06-23 07:09:50 +02:00
|
|
|
borgmatic check
|
2019-02-04 07:20:59 +01:00
|
|
|
```
|
|
|
|
|
2023-03-08 23:05:06 +01:00
|
|
|
You can run borgmatic with only one of these actions provided, or you can mix
|
|
|
|
and match any number of them in a single borgmatic run. This supports
|
|
|
|
approaches like skipping certain actions while running others. For instance,
|
|
|
|
this skips `prune` and `compact` and only runs `create` and `check`:
|
2020-03-09 19:20:18 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic create check
|
|
|
|
```
|
|
|
|
|
2023-03-08 22:19:41 +01:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.7.9</span> borgmatic
|
|
|
|
now respects your specified command-line action order, running actions in the
|
|
|
|
order you specify. In previous versions, borgmatic ran your specified actions
|
|
|
|
in a fixed ordering regardless of the order they appeared on the command-line.
|
|
|
|
|
|
|
|
But instead of running actions together, another option is to run backups with
|
|
|
|
`create` on a frequent schedule (e.g. with `borgmatic create` called from one
|
|
|
|
cron job), while only running expensive consistency checks with `check` on a
|
|
|
|
much less frequent basis (e.g. with `borgmatic check` called from a separate
|
|
|
|
cron job).
|
2020-03-09 19:20:18 +01:00
|
|
|
|
2023-11-09 03:22:17 +01:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.8.5</span> Instead of
|
|
|
|
(or in addition to) specifying actions on the command-line, you can configure
|
|
|
|
borgmatic to [skip particular
|
|
|
|
actions](https://torsion.org/borgmatic/docs/how-to/set-up-backups/#skipping-actions).
|
|
|
|
|
2019-02-04 07:20:59 +01:00
|
|
|
|
|
|
|
### Consistency check configuration
|
|
|
|
|
2022-11-14 23:58:42 +01:00
|
|
|
Another option is to customize your consistency checks. By default, if you
|
2022-11-15 00:13:47 +01:00
|
|
|
omit consistency checks from configuration, borgmatic runs full-repository
|
|
|
|
checks (`repository`) and per-archive checks (`archives`) within each
|
2023-03-17 18:09:36 +01:00
|
|
|
repository. (Although see below about check frequency.) This is equivalent to
|
|
|
|
what `borg check` does if run without options.
|
2019-02-04 07:20:59 +01:00
|
|
|
|
2019-02-05 05:58:27 +01:00
|
|
|
But if you find that archive checks are too slow, for example, you can
|
2019-02-04 07:20:59 +01:00
|
|
|
configure borgmatic to run repository checks only. Configure this in the
|
|
|
|
`consistency` section of borgmatic configuration:
|
|
|
|
|
|
|
|
```yaml
|
2023-07-12 07:10:57 +02:00
|
|
|
checks:
|
|
|
|
- name: repository
|
2019-02-04 07:20:59 +01:00
|
|
|
```
|
|
|
|
|
2023-07-12 07:10:57 +02:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.8.0</span> Put
|
|
|
|
this option in the `consistency:` section of your configuration.
|
|
|
|
|
2023-03-17 18:09:36 +01:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.6.2</span> The
|
|
|
|
`checks` option was a plain list of strings without the `name:` part, and
|
|
|
|
borgmatic ran each configured check every time checks were run. For example:
|
2023-02-13 06:42:43 +01:00
|
|
|
|
|
|
|
```yaml
|
2023-07-12 07:10:57 +02:00
|
|
|
checks:
|
|
|
|
- repository
|
2023-02-13 06:42:43 +01:00
|
|
|
```
|
|
|
|
|
2022-05-29 04:03:45 +02:00
|
|
|
|
2020-04-29 20:08:41 +02:00
|
|
|
Here are the available checks from fastest to slowest:
|
|
|
|
|
|
|
|
* `repository`: Checks the consistency of the repository itself.
|
|
|
|
* `archives`: Checks all of the archives in the repository.
|
|
|
|
* `extract`: Performs an extraction dry-run of the most recent archive.
|
2022-12-13 01:03:05 +01:00
|
|
|
* `data`: Verifies the data integrity of all archives contents, decrypting and decompressing all data.
|
|
|
|
|
|
|
|
Note that the `data` check is a more thorough version of the `archives` check,
|
|
|
|
so enabling the `data` check implicitly enables the `archives` check as well.
|
2020-04-29 20:08:41 +02:00
|
|
|
|
2022-08-12 23:53:20 +02:00
|
|
|
See [Borg's check
|
|
|
|
documentation](https://borgbackup.readthedocs.io/en/stable/usage/check.html)
|
|
|
|
for more information.
|
2020-04-29 20:08:41 +02:00
|
|
|
|
2023-05-16 08:17:45 +02:00
|
|
|
|
2022-05-28 23:42:19 +02:00
|
|
|
### Check frequency
|
|
|
|
|
2022-06-17 05:49:15 +02:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.6.2</span> You can
|
|
|
|
optionally configure checks to run on a periodic basis rather than every time
|
|
|
|
borgmatic runs checks. For instance:
|
2022-05-28 23:42:19 +02:00
|
|
|
|
|
|
|
```yaml
|
2023-07-12 07:10:57 +02:00
|
|
|
checks:
|
|
|
|
- name: repository
|
|
|
|
frequency: 2 weeks
|
|
|
|
- name: archives
|
|
|
|
frequency: 1 month
|
2022-05-28 23:42:19 +02:00
|
|
|
```
|
|
|
|
|
2023-07-12 07:10:57 +02:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.8.0</span> Put
|
|
|
|
this option in the `consistency:` section of your configuration.
|
|
|
|
|
2022-07-04 07:24:25 +02:00
|
|
|
This tells borgmatic to run the `repository` consistency check at most once
|
|
|
|
every two weeks for a given repository and the `archives` check at most once a
|
2023-11-09 02:57:31 +01:00
|
|
|
month. The `frequency` value is a number followed by a unit of time, e.g. `3
|
|
|
|
days`, `1 week`, `2 months`, etc. The set of possible time units is as
|
2023-11-09 02:53:59 +01:00
|
|
|
follows (singular or plural):
|
|
|
|
|
|
|
|
* `second`
|
|
|
|
* `minute`
|
|
|
|
* `hour`
|
|
|
|
* `day`
|
|
|
|
* `week` (7 days)
|
|
|
|
* `month` (30 days)
|
|
|
|
* `year` (365 days)
|
2023-03-17 18:09:36 +01:00
|
|
|
|
|
|
|
The `frequency` defaults to `always` for a check configured without a
|
|
|
|
`frequency`, which means run this check every time checks run. But if you omit
|
|
|
|
consistency checks from configuration entirely, borgmatic runs full-repository
|
|
|
|
checks (`repository`) and per-archive checks (`archives`) within each
|
|
|
|
repository, at most once a month.
|
2022-05-28 23:42:19 +02:00
|
|
|
|
|
|
|
Unlike a real scheduler like cron, borgmatic only makes a best effort to run
|
|
|
|
checks on the configured frequency. It compares that frequency with how long
|
|
|
|
it's been since the last check for a given repository (as recorded in a file
|
|
|
|
within `~/.borgmatic/checks`). If it hasn't been long enough, the check is
|
2022-08-22 06:48:37 +02:00
|
|
|
skipped. And you still have to run `borgmatic check` (or `borgmatic` without
|
|
|
|
actions) in order for checks to run, even when a `frequency` is configured!
|
2022-05-28 23:42:19 +02:00
|
|
|
|
2022-07-02 18:40:49 +02:00
|
|
|
This also applies *across* configuration files that have the same repository
|
2022-08-22 06:48:37 +02:00
|
|
|
configured. Make sure you have the same check frequency configured in each
|
|
|
|
though—or the most frequently configured check will apply.
|
2022-07-02 18:40:49 +02:00
|
|
|
|
2022-05-29 04:29:33 +02:00
|
|
|
If you want to temporarily ignore your configured frequencies, you can invoke
|
|
|
|
`borgmatic check --force` to run checks unconditionally.
|
|
|
|
|
2023-12-28 19:22:48 +01:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.8.6</span> `borgmatic
|
|
|
|
check --force` runs `check` even if it's specified in the `skip_actions`
|
|
|
|
option.
|
|
|
|
|
2022-05-28 23:42:19 +02:00
|
|
|
|
2023-06-26 07:49:36 +02:00
|
|
|
### Running only checks
|
|
|
|
|
|
|
|
<span class="minilink minilink-addedin">New in version 1.7.1</span> If you
|
|
|
|
would like to only run consistency checks without creating backups (for
|
|
|
|
instance with the `check` action on the command-line), you can omit
|
|
|
|
the `source_directories` option entirely.
|
|
|
|
|
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.7.1</span> In older
|
|
|
|
versions of borgmatic, instead specify an empty `source_directories` value, as
|
|
|
|
it is a mandatory option there:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
location:
|
|
|
|
source_directories: []
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2022-05-28 23:42:19 +02:00
|
|
|
### Disabling checks
|
|
|
|
|
2019-02-04 07:20:59 +01:00
|
|
|
If that's still too slow, you can disable consistency checks entirely,
|
|
|
|
either for a single repository or for all repositories.
|
|
|
|
|
2023-11-01 05:54:41 +01:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.8.5</span> Disabling
|
|
|
|
all consistency checks looks like this:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
skip_actions:
|
|
|
|
- check
|
|
|
|
```
|
|
|
|
|
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.8.5</span> Use this
|
|
|
|
configuration instead:
|
2019-02-04 07:20:59 +01:00
|
|
|
|
|
|
|
```yaml
|
2023-07-12 04:42:14 +02:00
|
|
|
checks:
|
|
|
|
- name: disabled
|
2019-02-04 07:20:59 +01:00
|
|
|
```
|
|
|
|
|
2023-07-12 04:42:14 +02:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.8.0</span> Put
|
2023-11-01 05:54:41 +01:00
|
|
|
`checks:` in the `consistency:` section of your configuration.
|
2023-07-12 04:42:14 +02:00
|
|
|
|
2023-11-01 05:54:41 +01:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.6.2</span>
|
|
|
|
`checks:` was a plain list of strings without the `name:` part. For instance:
|
2023-02-13 06:42:43 +01:00
|
|
|
|
|
|
|
```yaml
|
2023-07-12 07:10:57 +02:00
|
|
|
checks:
|
|
|
|
- disabled
|
2023-02-13 06:42:43 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
If you have multiple repositories in your borgmatic configuration file,
|
2019-02-04 07:20:59 +01:00
|
|
|
you can keep running consistency checks, but only against a subset of the
|
|
|
|
repositories:
|
|
|
|
|
|
|
|
```yaml
|
2023-07-12 04:42:14 +02:00
|
|
|
check_repositories:
|
|
|
|
- path/of/repository_to_check.borg
|
2019-02-04 07:20:59 +01:00
|
|
|
```
|
|
|
|
|
2023-07-19 08:27:45 +02:00
|
|
|
Finally, you can override your configuration file's consistency checks and
|
2019-09-19 20:50:29 +02:00
|
|
|
run particular checks via the command-line. For instance:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic check --only data --only extract
|
|
|
|
```
|
|
|
|
|
|
|
|
This is useful for running slow consistency checks on an infrequent basis,
|
2022-05-28 23:42:19 +02:00
|
|
|
separate from your regular checks. It is still subject to any configured
|
2022-05-29 04:29:33 +02:00
|
|
|
check frequencies unless the `--force` flag is used.
|
2019-09-19 20:50:29 +02:00
|
|
|
|
2019-02-05 05:53:47 +01:00
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
### Broken pipe with remote repository
|
|
|
|
|
|
|
|
When running borgmatic on a large remote repository, you may receive errors
|
|
|
|
like the following, particularly while "borg check" is validating backups for
|
|
|
|
consistency:
|
|
|
|
|
|
|
|
```text
|
|
|
|
Write failed: Broken pipe
|
|
|
|
borg: Error: Connection closed by remote host
|
|
|
|
```
|
|
|
|
|
|
|
|
This error can be caused by an ssh timeout, which you can rectify by adding
|
|
|
|
the following to the `~/.ssh/config` file on the client:
|
|
|
|
|
|
|
|
```text
|
|
|
|
Host *
|
|
|
|
ServerAliveInterval 120
|
|
|
|
```
|
|
|
|
|
|
|
|
This should make the client keep the connection alive while validating
|
|
|
|
backups.
|