2019-02-04 07:20:59 +01:00
|
|
|
---
|
|
|
|
title: How to inspect your backups
|
2020-08-21 23:27:47 +02:00
|
|
|
eleventyNavigation:
|
2022-05-20 20:11:35 +02:00
|
|
|
key: 🔎 Inspect your backups
|
2020-08-21 23:27:47 +02:00
|
|
|
parent: How-to guides
|
2022-06-17 00:30:53 +02:00
|
|
|
order: 5
|
2019-02-04 07:20:59 +01:00
|
|
|
---
|
|
|
|
## Backup progress
|
|
|
|
|
|
|
|
By default, borgmatic runs proceed silently except in the case of errors. But
|
|
|
|
if you'd like to to get additional information about the progress of the
|
|
|
|
backup as it proceeds, use the verbosity option:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --verbosity 1
|
|
|
|
```
|
|
|
|
|
|
|
|
This lists the files that borgmatic is archiving, which are those that are new
|
|
|
|
or changed since the last backup.
|
|
|
|
|
|
|
|
Or, for even more progress and debug spew:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --verbosity 2
|
|
|
|
```
|
|
|
|
|
2019-09-23 22:13:34 +02:00
|
|
|
## Backup summary
|
|
|
|
|
2019-10-15 19:49:14 +02:00
|
|
|
If you're less concerned with progress during a backup, and you only want to
|
2019-09-23 22:13:34 +02:00
|
|
|
see the summary of archive statistics at the end, you can use the stats
|
2019-10-01 21:23:16 +02:00
|
|
|
option when performing a backup:
|
2019-09-23 22:13:34 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --stats
|
|
|
|
```
|
|
|
|
|
2019-02-04 07:20:59 +01:00
|
|
|
## Existing backups
|
|
|
|
|
2019-10-14 00:58:11 +02:00
|
|
|
borgmatic provides convenient actions for Borg's
|
2022-08-12 23:53:20 +02:00
|
|
|
[`list`](https://borgbackup.readthedocs.io/en/stable/usage/list.html) and
|
|
|
|
[`info`](https://borgbackup.readthedocs.io/en/stable/usage/info.html)
|
2019-02-04 07:20:59 +01:00
|
|
|
functionality:
|
|
|
|
|
|
|
|
```bash
|
2019-06-23 07:09:50 +02:00
|
|
|
borgmatic list
|
|
|
|
borgmatic info
|
2019-02-04 07:20:59 +01:00
|
|
|
```
|
|
|
|
|
2022-08-20 00:16:17 +02:00
|
|
|
You can change the output format of `borgmatic list` by specifying your own
|
2022-08-20 00:27:03 +02:00
|
|
|
with `--format`. Refer to the [borg list --format
|
2022-08-20 00:16:17 +02:00
|
|
|
documentation](https://borgbackup.readthedocs.io/en/stable/usage/list.html#the-format-specifier-syntax)
|
|
|
|
for available values.
|
|
|
|
|
|
|
|
*(No borgmatic `list` or `info` actions? Upgrade borgmatic!)*
|
|
|
|
|
2022-08-16 00:04:40 +02:00
|
|
|
<span class="minilink minilink-addedin">New in borgmatic version 1.7.0</span>
|
|
|
|
There are also `rlist` and `rinfo` actions for displaying repository
|
|
|
|
information with Borg 2.x:
|
2019-06-24 01:42:23 +02:00
|
|
|
|
2022-08-12 23:53:20 +02:00
|
|
|
```bash
|
2022-08-16 00:04:40 +02:00
|
|
|
borgmatic rlist
|
2022-08-12 23:53:20 +02:00
|
|
|
borgmatic rinfo
|
|
|
|
```
|
2019-10-14 00:58:11 +02:00
|
|
|
|
2022-08-16 00:04:40 +02:00
|
|
|
See the [borgmatic command-line
|
|
|
|
reference](https://torsion.org/borgmatic/docs/reference/command-line/) for
|
|
|
|
more information.
|
2019-06-24 01:42:23 +02:00
|
|
|
|
2019-10-14 00:58:11 +02:00
|
|
|
|
2022-06-04 00:12:14 +02:00
|
|
|
### Searching for a file
|
|
|
|
|
2022-06-17 05:49:15 +02:00
|
|
|
<span class="minilink minilink-addedin">New in version 1.6.3</span> Let's say
|
|
|
|
you've accidentally deleted a file and want to find the backup archive(s)
|
|
|
|
containing it. `borgmatic list` provides a `--find` flag for exactly this
|
|
|
|
purpose. For instance, if you're looking for a `foo.txt`:
|
2022-06-04 00:12:14 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic list --find foo.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
This will list your archives and indicate those with files matching
|
|
|
|
`*foo.txt*` anywhere in the archive. The `--find` parameter can alternatively
|
|
|
|
be a [Borg
|
|
|
|
pattern](https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-patterns).
|
|
|
|
|
|
|
|
To limit the archives searched, use the standard `list` parameters for
|
2022-10-04 07:50:37 +02:00
|
|
|
filtering archives such as `--last`, `--archive`, `--match-archives`, etc. For
|
2022-06-04 00:12:14 +02:00
|
|
|
example, to search only the last five archives:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic list --find foo.txt --last 5
|
|
|
|
```
|
|
|
|
|
2023-03-09 01:09:41 +01:00
|
|
|
## Listing database dumps
|
2022-07-13 13:29:45 +02:00
|
|
|
|
2023-03-09 01:09:41 +01:00
|
|
|
If you have enabled borgmatic's [database
|
|
|
|
hooks](https://torsion.org/borgmatic/docs/how-to/backup-your-databases/), you
|
|
|
|
can list backed up database dumps via borgmatic. For example:
|
2022-07-13 13:29:45 +02:00
|
|
|
|
|
|
|
```bash
|
2023-03-09 01:09:41 +01:00
|
|
|
borgmatic list --archive latest --find .borgmatic/*_databases
|
2022-07-13 13:29:45 +02:00
|
|
|
```
|
|
|
|
|
2023-03-09 01:09:41 +01:00
|
|
|
This gives you a listing of all database dump files contained in the latest
|
|
|
|
archive, complete with file sizes.
|
2022-07-13 22:03:51 +02:00
|
|
|
|
2022-06-04 00:12:14 +02:00
|
|
|
|
2019-06-12 01:42:04 +02:00
|
|
|
## Logging
|
|
|
|
|
|
|
|
By default, borgmatic logs to a local syslog-compatible daemon if one is
|
2019-06-27 23:41:21 +02:00
|
|
|
present and borgmatic is running in a non-interactive console. Where those
|
|
|
|
logs show up depends on your particular system. If you're using systemd, try
|
|
|
|
running `journalctl -xe`. Otherwise, try viewing `/var/log/syslog` or
|
2023-04-01 18:40:32 +02:00
|
|
|
similar.
|
2019-06-12 06:35:43 +02:00
|
|
|
|
|
|
|
You can customize the log level used for syslog logging with the
|
2019-06-12 01:42:04 +02:00
|
|
|
`--syslog-verbosity` flag, and this is independent from the console logging
|
2019-06-17 06:57:14 +02:00
|
|
|
`--verbosity` flag described above. For instance, to get additional
|
|
|
|
information about the progress of the backup as it proceeds:
|
2019-06-12 01:42:04 +02:00
|
|
|
|
|
|
|
```bash
|
2019-06-17 06:57:14 +02:00
|
|
|
borgmatic --syslog-verbosity 1
|
2019-06-12 01:42:04 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Or to increase syslog logging to include debug spew:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --syslog-verbosity 2
|
|
|
|
```
|
|
|
|
|
2019-11-12 21:32:32 +01:00
|
|
|
### Rate limiting
|
|
|
|
|
|
|
|
If you are using rsyslog or systemd's journal, be aware that by default they
|
|
|
|
both throttle the rate at which logging occurs. So you may need to change
|
|
|
|
either [the global rate
|
|
|
|
limit](https://www.rootusers.com/how-to-change-log-rate-limiting-in-linux/) or
|
|
|
|
[the per-service rate
|
|
|
|
limit](https://www.freedesktop.org/software/systemd/man/journald.conf.html#RateLimitIntervalSec=)
|
|
|
|
if you're finding that borgmatic logs are missing.
|
|
|
|
|
|
|
|
Note that the [sample borgmatic systemd service
|
|
|
|
file](https://torsion.org/borgmatic/docs/how-to/set-up-backups/#systemd)
|
|
|
|
already has this rate limit disabled for systemd's journal.
|
|
|
|
|
|
|
|
|
2019-11-02 19:23:18 +01:00
|
|
|
### Logging to file
|
|
|
|
|
|
|
|
If you don't want to use syslog, and you'd rather borgmatic log to a plain
|
|
|
|
file, use the `--log-file` flag:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --log-file /path/to/file.log
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that if you use the `--log-file` flag, you are responsible for rotating
|
2020-01-01 00:06:53 +01:00
|
|
|
the log file so it doesn't grow too large, for example with
|
2023-04-03 08:06:36 +02:00
|
|
|
[logrotate](https://wiki.archlinux.org/index.php/Logrotate).
|
|
|
|
|
|
|
|
You can the `--log-file-verbosity` flag to customize the log file's log level:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --log-file /path/to/file.log --log-file-verbosity 2
|
|
|
|
```
|
|
|
|
|
|
|
|
<span class="minilink minilink-addedin">New in borgmatic version 1.7.11</span>
|
|
|
|
Use the `--log-file-format` flag to override the default log message format.
|
|
|
|
This format string can contain a series of named placeholders wrapped in curly
|
|
|
|
brackets. For instance, the default log format is: `[{asctime}] {levelname}:
|
|
|
|
{message}`. This means each log message is recorded as the log time (in square
|
|
|
|
brackets), a logging level name, a colon, and the actual log message.
|
|
|
|
|
|
|
|
So if you just want each log message to get logged *without* a timestamp or a
|
|
|
|
logging level name:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
borgmatic --log-file /path/to/file.log --log-file-format "{message}"
|
|
|
|
```
|
|
|
|
|
|
|
|
Here is a list of available placeholders:
|
|
|
|
|
|
|
|
* `{asctime}`: time the log message was created
|
|
|
|
* `{levelname}`: level of the log message (`INFO`, `DEBUG`, etc.)
|
|
|
|
* `{lineno}`: line number in the source file where the log message originated
|
|
|
|
* `{message}`: actual log message
|
|
|
|
* `{pathname}`: path of the source file where the log message originated
|
|
|
|
|
|
|
|
See the [Python logging
|
|
|
|
documentation](https://docs.python.org/3/library/logging.html#logrecord-attributes)
|
|
|
|
for additional placeholders.
|
|
|
|
|
|
|
|
Note that this `--log-file-format` flg only applies to the specified
|
|
|
|
`--log-file` and not to syslog or other logging.
|