'\" t .\" Title: btrbk .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.12 .\" Date: 2021-11-23 .\" Manual: Btrbk Manual .\" Source: Btrbk .\" Language: English .\" .TH "BTRBK" "1" "2021-11-23" "Btrbk" "Btrbk Manual" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" btrbk \- backup tool for btrfs subvolumes .SH "SYNOPSIS" .sp .sp .nf btrbk [\-h|\-\-help] [\-\-version] [\-c|\-\-config ] [\-n|\-\-dry\-run] [\-p|\-\-preserve] [\-\-preserve\-snapshots] [\-\-preserve\-backups] [\-v|\-\-verbose] [\-q|\-\-quiet] [\-l|\-\-loglevel ] [\-t|\-\-table] [\-\-format ] [\-\-progress] [\-S|\-\-print\-schedule] [\-\-override =] [\-\-lockfile ] [] .fi .br .SH "DESCRIPTION" .sp \fBbtrbk\fP 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. .sp For most operations, \fBbtrbk\fP requires \fIroot privileges\fP 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 \fIbackend\fP in btrbk.conf(5) for more details. .SS "Snapshots and Backups" .sp Snapshots as well as backup subvolumes are created in form: .sp .if n .RS 4 .nf .fam C .[_N] .fam .fi .if n .RE .sp Where \fI\fP is identical to the source subvolume name, unless the configuration option \fIsnapshot_name\fP is set. The is either "YYYYMMDD" or "YYYYMMDDThhmm" (dependent of the \fItimestamp_format\fP configuration option), where "YYYY" is the year, "MM" is the month, "DD" is the day, "hh" is the hour and "mm" is the minute of the creation time (local time of the host running btrbk). If multiple snapshots/backups are created on the same date/time, N will be incremented on each snapshot, starting at 1. .sp Note that \fIsnapshot\fP is a btrfs terminology for a \(lqread\-only subvolume\(rq (showing a parent\-uuid, see btrfs\-subvolume(8)); \fIbackup\fP is a btrbk terminology for a \(lqread\-only subvolume created with send/receive\(rq (showing a received\-uuid). .SH "OPTIONS" .sp \-h, \-\-help .RS 4 Prints the synopsis and a list of the commands. .RE .sp \-\-version .RS 4 Prints the btrbk version. .RE .sp \-n, \-\-dry\-run .RS 4 Don\(cqt run anything that would alter the filesystem, just show the snapshots and backup subvolumes that would be created/deleted by the \fBrun\fP, \fBsnapshot\fP, \fBresume\fP, \fBprune\fP, \fBarchive\fP and \fBclean\fP commands. Use in conjunction with \fI\-l debug\fP to see the btrfs commands that would be executed. .RE .sp \-c, \-\-config .RS 4 Read the configuration from . .RE .sp \-p, \-\-preserve .RS 4 Preserve all snapshots and backups. Skips deletion of any snapshots and backups, even if specified in the configuration file (shortcut for "\-\-preserve\-snapshots \-\-preserve\-backups"). .RE .sp \-\-preserve\-snapshots .RS 4 Preserve all snapshots. Skips deletion of any snapshots, even if specified in the configuration file. .RE .sp \-\-preserve\-backups .RS 4 Preserve all backups. Skips deletion of any backups, even if specified in the configuration file. .RE .sp \-\-wipe .RS 4 Ignore configured snapshot retention policy, delete all but latest snapshots instead. All snapshots needed for incremental backup (latest common) are also preserved. Useful if you are getting low on disk space (ENOSPC). .RE .sp \-v, \-\-verbose .RS 4 Verbose output (shortcut for "\-\-loglevel=info"). .RE .sp \-q, \-\-quiet .RS 4 Quiet operation. If set, btrbk does not print the summary after executing the \fBrun\fP, \fBsnapshot\fP, \fBresume\fP, \fBprune\fP, or \fBarchive\fP commands. .RE .sp \-l, \-\-loglevel .RS 4 Set the level of verbosity. Accepted levels are warn, info, debug, and trace. .RE .sp \-t, \-\-table .RS 4 Print output in table format (shortcut for "\-\-format=table"). .RE .sp \-\-format table|long|raw .RS 4 Print output in specified format. If set to "raw", prints space\-separated key="value" pairs (machine readable). Affects output format for \fBrun\fP, \fBsnapshot\fP, \fBresume\fP, \fBprune\fP, \fBarchive\fP and \fBlist\fP commands. Useful for further exporting/scripting. .RE .sp \-\-progress .RS 4 Show progress bar on send\-receive operation. .RE .sp \-S, \-\-print\-schedule .RS 4 Print detailed scheduler information on \fBrun\fP, \fBsnapshot\fP, \fBresume\fP, \fBprune\fP and \fBarchive\fP commands. Use the \fI\-\-format\fP command line option to switch between different output formats. .RE .sp \-\-lockfile .RS 4 Create lockfile on startup; checks lockfile before running any btrfs commands (using perl "flock"), and exits if the lock is held by another btrbk instance. Overrides configuration option "lockfile". Ignored on dryrun (\fI\-n\fP, \fI\-\-dry\-run\fP). .RE .sp \-\-override = .RS 4 Override a configuration option with . Globally, for ALL contexts. Use with care! .RE .SH "COMMANDS" .SS "Actions" .sp The following commands are used to create snapshots and/or backups. All actions can operate in dry\-run mode (\fI\-n\fP, \fI\-\-dry\-run\fP). Use the \fI\-\-format\fP command line option to switch between different output formats. .sp See section RETENTION POLICY in \fBbtrbk.conf\fP(5) for information on configuring the retention policy. .sp \fBrun\fP [filter...] .RS 4 Perform snapshot and backup operations as specified in the configuration file. If the optional [filter...] arguments are present, snapshots and backups are only performed for the subvolumes/targets matching a filter statement (see FILTER STATEMENTS below). .sp \fBStep 0: Read Data\fP .RS 4 Read information from the source and target btrfs filesystems in order to perform sanity checks and identify parent/child and received\-from relationships. .RE .sp \fBStep 1: Create Snapshots\fP .RS 4 If the checks succeed, btrbk creates snapshots for the source subvolumes specified in the configuration file, according to the \fIsnapshot_create\fP option. .RE .sp \fBStep 2: Create Backups\fP .RS 4 For each specified target, btrbk creates the backups as follows: After comparing the backups to the source snapshots, btrbk transfers all missing snapshots needed to satisfy the configured target retention policy, incrementally from the latest common parent subvolume found. If no common parent subvolume is found (or if the \fIincremental\fP option is set to \(lqno\(rq), a full (non\-incremental) backup is created. .RE .sp \fBStep 3: Delete Backups\fP .RS 4 Unless the \-p, \-\-preserve or \-\-preserve\-backups option is set, backup subvolumes that are not preserved by their configured retention policy will be deleted. Note that the latest snapshot/backup pair are always preserved, regardless of the retention policy. .RE .sp \fBStep 4: Delete Snapshots\fP .RS 4 Unless the \-p, \-\-preserve or \-\-preserve\-snapshots option is set, snapshots that are not preserved by their configured retention policy will be deleted. Note that the latest snapshot (the one created in step 1) as well as the latest snapshot/backup pair are always preserved, regardless of the retention policy. .RE .RE .sp \fBdryrun\fP [filter...] .RS 4 Don\(cqt run any btrfs commands that would alter the filesystem, just show the snapshots and backup subvolumes that would be created/deleted by the \fBrun\fP command. Use in conjunction with \fI\-l debug\fP to see the btrfs commands that would be executed. .RE .sp \fBsnapshot\fP [filter...] .RS 4 Snapshot only: skips backup creation and deletion (steps 2 and 3). Use in conjunction with \-p, \-\-preserve (or \-\-preserve\-snapshots) if you also want to skip snapshot deletion (step 4). .sp 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). .RE .sp \fBresume\fP [filter...] .RS 4 Resume backups: skips snapshot creation (step 1), transfers and deletes snapshots/backups in order to satisfy their configured retention policy. Use in conjunction with \-p, \-\-preserve, \-\-preserve\-backups, \-\-preserve\-snapshots if you want to skip backup and/or snapshot deletion (steps 3, 4). .RE .sp \fBprune\fP [filter...] .RS 4 Prune snapshots and backups: skips snapshot and backup creation (steps 1, 2), only deletes snapshots and backups in order to satisfy their configured retention policy. Useful for cleaning the disk after changing the retention policy. Use in conjunction with \-\-preserve\-backups, \-\-preserve\-snapshots if you want to skip backup or snapshot deletion (steps 3, 4). .sp 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). .RE .sp \fBarchive\fP \fI*experimental*\fP .RS 4 Recursively copy all subvolumes created by btrbk from to directory, optionally rescheduled using \fIarchive_preserve_*\fP configuration options. Also creates directory tree on (see bugs below). Useful for creating extra archive copies (clones) from your backup disks. Note that you can continue using btrbk after swapping your backup disk with the archive disk. .sp 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 /dir"). Check the output of \-\-dry\-run if unsure. .sp Note that this feature needs a \fBlinux kernel >=4.4\fP to work correctly! .RE .sp \fBclean\fP [filter...] .RS 4 Delete incomplete (garbled) backups. Incomplete backups can be left behind on network errors or kill signals while a send/receive operation is ongoing, and are identified by the "received_uuid" flag not being set on a target (backup) subvolume. .RE .sp 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\-): .sp .if n .RS 4 .nf .fam C 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 .fam .fi .if n .RE .SS "Informative Commands" .sp The following commands are informative only, and will not alter the file system. .sp \fBstats\fP [filter...] .RS 4 Print statistics of snapshot and backup subvolumes. Optionally filtered by [filter...] arguments (see FILTER STATEMENTS below). .RE .sp \fBlist\fP [filter...] .RS 4 Print information defined by in a tabular form. Optionally filtered by [filter...] arguments (see FILTER STATEMENTS below). .sp Available subcommands: .sp \fBsnapshots\fP .RS 4 List all snapshots (and corresponding backups). Note that all snapshots related to configured subvolumes are listed, not only the ones created by btrbk. .RE .sp \fBbackups\fP .RS 4 List all backups (and corresponding snapshots). .RE .sp \fBlatest\fP .RS 4 List most recent common snapshot/backup pair, or most recent snapshot if no common found. .RE .sp \fBconfig\fP .RS 4 List configured source/snapshot/target relations. .RE .sp \fBsource\fP .RS 4 List configured source/snapshot relations. .RE .sp \fBvolume\fP .RS 4 List configured volume sections. .RE .sp \fBtarget\fP .RS 4 List configured targets. .RE .sp Use the \fI\-\-format\fP command line option to switch between different output formats. .RE .sp \fBusage\fP [filter...] .RS 4 Print filesystem usage information for all source/target volumes, optionally filtered by [filter...] arguments (see FILTER STATEMENTS below). Note that the "free" value is an estimate of the amount of data that can still be written to the file system. .RE .sp \fBorigin\fP .RS 4 Print the subvolume origin tree: Shows the parent\-child relationships as well as the received\-from information. Use the \fI\-\-format\fP command line option to switch between different output formats. .RE .sp \fBdiff\fP .RS 4 Print new files since subvolume for subvolume . .RE .sp \fBconfig\fP print|print\-all .RS 4 Prints the parsed configuration file. Use the \fI\-\-format\fP command line option to switch between different output formats. .RE .SH "FILTER STATEMENTS" .sp Filter arguments are accepted in form: .sp .RS 4 Matches the \fIgroup\fP configuration option of a \fIvolume\fP, \fIsubvolume\fP or \fItarget\fP section (including all underlying sections). .RE .sp [hostname:] .RS 4 Matches all subvolumes and targets of a \fIvolume\fP configuration section. .RE .sp [hostname:]/ .RS 4 Matches the specified subvolume and all targets of a \fIsubvolume\fP configuration section. .RE .sp [hostname:] .RS 4 Matches all targets of a \fItarget\fP configuration section. .RE .sp [hostname:]/ .RS 4 Matches a single target of a \fItarget\fP section within a \fIsubvolume\fP section with given . .RE .sp For convenience, [hostname:] can be specified as either "hostname:" or "ssh://hostname/". .sp Note that for \fBrun\fP and \fBsnapshot\fP commands, a filter matching a \fItarget\fP configuration section also enables snapshot creation of the surrounding \fIsubvolume\fP section. If this is not desired, consider running \fBsnapshot\fP and \fBresume\fP commands separately. .SH "FILES" .sp \f(CR/etc/btrbk.conf\fP, \f(CR/etc/btrbk/btrbk.conf\fP .RS 4 Default configuration file. The file format and configuration options are described in \fBbtrbk.conf\fP(5). .RE .SH "EXIT STATUS" .sp \fBbtrbk\fP returns the following error codes: .sp 0 .RS 4 No problems occurred. .RE .sp 1 .RS 4 Generic error code. .RE .sp 2 .RS 4 Parse error: when parsing command\-line options or configuration file. .RE .sp 3 .RS 4 Lockfile error: if lockfile is present on startup. .RE .sp 10 .RS 4 Backup abort: At least one backup task aborted. .RE .sp 255 .RS 4 Script error. .RE .SH "AVAILABILITY" .sp Please refer to the btrbk project page \fB\c .URL "https://digint.ch/btrbk/" "" "\fP" for further details. .SH "SEE ALSO" .sp \fBbtrbk.conf\fP(5), \fBbtrfs\fP(8) .sp For more information about btrfs and incremental backups, see the web site at \c .URL "https://btrfs.wiki.kernel.org/index.php/Incremental_Backup" "" "" .SH "AUTHOR" .sp Axel Burri <\c .MTO "axel\(attty0.ch" "" ">"