2020-07-18 01:00:50 +02:00
|
|
|
---
|
|
|
|
title: How to make backups redundant
|
2020-08-21 23:27:47 +02:00
|
|
|
eleventyNavigation:
|
2022-05-20 20:11:35 +02:00
|
|
|
key: ☁️ Make backups redundant
|
2020-08-21 23:27:47 +02:00
|
|
|
parent: How-to guides
|
2022-06-17 00:30:53 +02:00
|
|
|
order: 3
|
2020-07-18 01:00:50 +02:00
|
|
|
---
|
|
|
|
## Multiple repositories
|
|
|
|
|
|
|
|
If you really care about your data, you probably want more than one backup of
|
|
|
|
it. borgmatic supports this in its configuration by specifying multiple backup
|
|
|
|
repositories. Here's an example:
|
|
|
|
|
|
|
|
```yaml
|
2023-07-12 04:42:14 +02:00
|
|
|
# List of source directories to backup.
|
|
|
|
source_directories:
|
|
|
|
- /home
|
|
|
|
- /etc
|
2020-07-18 01:00:50 +02:00
|
|
|
|
2023-07-12 04:42:14 +02:00
|
|
|
# Paths of local or remote repositories to backup to.
|
|
|
|
repositories:
|
|
|
|
- path: ssh://k8pDxu32@k8pDxu32.repo.borgbase.com/./repo
|
|
|
|
- path: /var/lib/backups/local.borg
|
2020-07-18 01:00:50 +02:00
|
|
|
```
|
|
|
|
|
2023-07-12 04:42:14 +02:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.8.0</span> Put
|
|
|
|
these options in the `location:` section of your configuration.
|
|
|
|
|
2023-03-28 06:49:31 +02:00
|
|
|
<span class="minilink minilink-addedin">Prior to version 1.7.10</span> Omit
|
|
|
|
the `path:` portion of the `repositories` list.
|
|
|
|
|
2020-07-18 01:00:50 +02:00
|
|
|
When you run borgmatic with this configuration, it invokes Borg once for each
|
|
|
|
configured repository in sequence. (So, not in parallel.) That means—in each
|
|
|
|
repository—borgmatic creates a single new backup archive containing all of
|
|
|
|
your source directories.
|
|
|
|
|
|
|
|
Here's a way of visualizing what borgmatic does with the above configuration:
|
|
|
|
|
2023-03-28 08:16:44 +02:00
|
|
|
1. Backup `/home` and `/etc` to `k8pDxu32@k8pDxu32.repo.borgbase.com:repo`
|
|
|
|
2. Backup `/home` and `/etc` to `/var/lib/backups/local.borg`
|
2020-07-18 01:00:50 +02:00
|
|
|
|
|
|
|
This gives you redundancy of your data across repositories and even
|
|
|
|
potentially across providers.
|
|
|
|
|
|
|
|
See [Borg repository URLs
|
|
|
|
documentation](https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls)
|
|
|
|
for more information on how to specify local and remote repository paths.
|
2022-11-21 22:33:01 +01:00
|
|
|
|
|
|
|
### Different options per repository
|
|
|
|
|
|
|
|
What if you want borgmatic to backup to multiple repositories—while also
|
|
|
|
setting different options for each one? In that case, you'll need to use
|
|
|
|
[a separate borgmatic configuration file for each
|
|
|
|
repository](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/)
|
|
|
|
instead of the multiple repositories in one configuration file as described
|
|
|
|
above. That's because all of the repositories in a particular configuration
|
|
|
|
file get the same options applied.
|