table of contents
- bookworm 0.32.5-1
- testing 0.32.5-1.1
- unstable 0.32.5-1.1
- experimental 0.32.6-1
BTRBK(1) | Btrbk Manual | BTRBK(1) |
NAME¶
btrbk - backup tool for btrfs subvolumes
SYNOPSIS¶
btrbk [-h|--help] [--version]
[-c|--config <file>] [-n|--dry-run] [--exclude <filter>]
[-p|--preserve] [--preserve-snapshots] [--preserve-backups]
[-v|--verbose] [-q|--quiet] [-l|--loglevel <level>]
[-t|--table] [-L|--long] [-1|--single-column]
[--format <output-format>] [--pretty]
[-S|--print-schedule] [--progress]
[--lockfile <file>]
[--override <config_option>=<value>]
<command> [[--] <filter>...]
DESCRIPTION¶
btrbk is a backup tool for btrfs subvolumes, taking advantage of btrfs specific capabilities to create atomic snapshots and transfer them incrementally to a target btrfs filesystem. It is able to perform backups from one source to multiple destinations.
For most operations, btrbk requires root privileges to run correctly. Alternatively, consider using "btrfs-progs-sudo" or "btrfs-progs-btrbk" backends, both of which allows you to run btrbk as a regular user. Refer to configuration option backend in btrbk.conf(5) for more details.
Snapshots and Backups¶
Snapshots as well as backup subvolumes are created in the form:
<snapshot-name>.<timestamp>[_N]
Where <snapshot-name> is identical to the source subvolume name, unless the configuration option snapshot_name is set. <timestamp> is a timestamp describing the creation time (local time of the host running btrbk) of the snapshot/backup. The format can be configured using the timestamp_format option, refer to btrbk.conf(5) for details. If multiple snapshots/backups are created on the same date/time, N will be incremented on each snapshot, starting at 1.
If a snapshot or backup does not match the naming scheme above (e.g. if it has been renamed manually), btrbk will leave it untouched.
Note that in btrfs terminology, a snapshot is a “subvolume with a given initial content of the original subvolume” (showing a parent-uuid, see btrfs-subvolume(8)), and they can be read-write (default) or read-only. In btrbk terminology, snapshot means “read-only btrfs snapshot”, and backup means “read-only subvolume created with send/receive” (showing a received-uuid).
OPTIONS¶
-h, --help
--version
-c, --config <file>
-n, --dry-run
--exclude <filter>
-p, --preserve
--preserve-snapshots
--preserve-backups
--wipe
-v, --verbose
-q, --quiet
-l, --loglevel <level>
-t, --table
-L, --long
-1, --single-column
--format table|long|raw|col:[h:]<columns>
If set to "col:", prints only the <columns> specified (comma-separated list). Header lines are ommitted if the "h:" modifier is present. Columns prefixed with "-" are collapsed if empty. Columns postfixed with ":RALIGN" are right-aligned.
--pretty
-S, --print-schedule
--progress
--lockfile <file>
--override <config_option>=<value>
COMMANDS¶
Actions¶
The following commands are used to create snapshots and/or backups. All actions can operate in dry-run mode (-n, --dry-run). Use the --format command line option to switch between different output formats.
See section RETENTION POLICY in btrbk.conf(5) for information on configuring the retention policy.
run [filter...]
Step 0: Read Data
Step 1: Create Snapshots
Step 2: Create Backups
Step 3: Delete Backups
Step 4: Delete Snapshots
dryrun [filter...]
snapshot [filter...]
Note that snapshot deletion is skipped if the target is not accessible, as it is still required in order to determine the latest snapshot/backup pair (which is always preserved, regardless of the retention policy).
resume [filter...]
prune [filter...]
Note that deletion is skipped if source or target is not accessible, as it is still required in order to determine the latest snapshot/backup pair (which is always preserved, regardless of the retention policy).
archive <source> <target> [--raw]
If you want to use nested subvolumes on the target filesystem, you need to create them by hand (e.g. by running "btrfs subvolume create <target>/dir"). Check the output of --dry-run if unsure.
Note that this feature needs a linux kernel >=4.4 to work correctly!
If --raw option is set, creates raw targets (experimental, see btrbk.conf(5), TARGET TYPES).
clean [filter...]
The following table gives a quick overview of the action commands and resulting snapshot creation (S+), backup creation (B+), snapshot deletion (S-), and backup deletion (B-):
Command Option S+ B+ S- B- -------------------------------------------- run x x x x run --preserve x x run --preserve-snapshots x x x run --preserve-backups x x x snapshot x x snapshot --preserve x resume x x x resume --preserve x resume --preserve-snapshots x x resume --preserve-backups x x prune x x prune --preserve-snapshots x prune --preserve-backups x
Informative Commands¶
The following commands are informative only, and will not alter the file system.
stats [filter...]
list <subcommand> [filter...]
Available subcommands (default “all”):
all
snapshots
backups
latest
config
source
volume
target
Use the --format command line option to switch between different output formats.
usage [filter...]
origin <subvolume>
diff <from> <to>
SIZE file was modified for a total of SIZE bytes COUNT file was modified in COUNT generations FLAGS "+" file accessed at offset 0 (at least once)
"c" COMPRESS flag is set (at least once)
"i" INLINE flag is set (at least once)
extents [diff] <subvolume>... [exclusive <subvolume>...]
Subvolumes following the exclusive keyword are added to a separate set, and additional set-exclusive data is printed at the end of the list. This gives a hint of how much data will be freed if deleting all subvolumes in the set. Example:
btrbk extents diff /backup/data.* exclusive /backup/data.2010*
The EXCLUSIVE column shows the set-exclusive data of all other listed (!) subvolumes (relative complement of block regions). Provided that all related subvolumes (holding references to extents) are also listed, this amount of disk space would be freed when deleting the subvolume.
The DIFF column shows the data added to the previous subvolume (relative complement of block regions).
If called with the --related option, btrbk also lists all related subvolumes. This is not recommended for backups, as parent-uuid relations break for received subvolumes as soon as an intermediate subvolume is deleted.
Note that reading all extents is a disk-intensive task, expect long execution times and high ram usage. Consider setting cache_dir.
ls <path>|<url>...
config print|print-all
FILTER STATEMENTS¶
Filter arguments are accepted in form:
<group-name>
<hostname>[:<port>]
<directory>|<url>
<volume-directory>
<volume-directory>/<subvolume-name>
<volume-directory>/<snapshot-dir>/<snapshot-name>
<target-directory>
<target-directory>/<snapshot-name>
Accepted formats for <url> are:
ssh://<hostname>[:<port>]/<directory> <hostname>:<directory>
Note that for run and snapshot commands, a filter matching a target configuration section also enables snapshot creation of the surrounding subvolume section. If this is not desired, consider running snapshot and resume commands separately.
Filter statements can match multiple times (e.g. on group as well as host name). In such a case, all matches are processed.
FILES¶
/etc/btrbk.conf, /etc/btrbk/btrbk.conf
EXIT STATUS¶
btrbk returns the following error codes:
0
1
2
3
10
255
AVAILABILITY¶
Please refer to the btrbk project page <https://digint.ch/btrbk/> for further details.
SEE ALSO¶
For more information about btrfs and incremental backups, see the web site at <https://btrfs.wiki.kernel.org/index.php/Incremental_Backup>
AUTHOR¶
Axel Burri <axel@tty0.ch>
2022-10-23 | Btrbk 0.32.5 |