'\" t .\" Title: btrbk.conf .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.12 .\" Date: 2021-11-23 .\" Manual: Btrbk Manual .\" Source: Btrbk .\" Language: English .\" .TH "BTRBK.CONF" "5" "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.conf \- btrbk configuration file .SH "SYNOPSIS" .sp .sp .nf /etc/btrbk.conf /etc/btrbk/btrbk.conf .fi .br .SH "DESCRIPTION" .sp The btrbk configuration file specifies which btrfs subvolumes on the filesystem are to be processed, what target subvolumes should be used to create the backups, and where the snapshots should be generated. The retention policy, as well as most other options can be defined either globally or within a section. .sp The options specified always apply to the last section encountered, superseding the values set in upper\-level sections. This means that global options must be set before any sections are defined. .sp Blank lines are ignored. A hash character (#) starts a comment extending until end of line. .SH "SECTIONS" .sp \fBvolume\fP | .RS 4 Directory of a btrfs volume containing the source subvolume(s) to be backed up. \fI\fP must be an absolute path and point to a btrfs volume (or subvolume). Usually the mount point of a btrfs filesystem mounted with the \fIsubvolid=5\fP option. .RE .sp \fBsubvolume\fP .RS 4 Subvolume to be backed up, relative to the \fI\fP specified in the \fIvolume\fP section. Multiple \fIsubvolume\fP sections are allowed within \fIvolume\fP sections. Accepts wildcard character "*". .sp If set to ".", the subvolume at \fI\fP is used as backup source, and the snapshots will be created within the source subvolume itself (see \fIsnapshot_dir\fP option below), which is not recommended. Note that if this subvolume is btrfs root (id=5), it needs to have a valid UUID, which is not the case for file systems created with btrfs\-progs < 4.16. .RE .sp \fBtarget\fP | .RS 4 Target type and directory where the backup subvolumes are to be created. See the TARGET TYPES section for supported \fI\fP. Multiple \fItarget\fP sections are allowed within \fIsubvolume\fP sections. A \fItarget\fP section defined in the global context or in a \fIvolume\fP section is propagated (multiplied) to all underlying \fIsubvolume\fP sections, unless a target with the same declaration already exists (hint: run "btrbk config print" to see the resulting configuration). .RE .sp .RS 4 Run actions locally. .sp Note that \fIwhitespace\fP or \fIunicode\fP characters are NOT allowed for file names. Allowed characters are: .sp .if n .RS 4 .nf .fam C [0\-9] [a\-z] [A\-Z] and "._+\-@" .fam .fi .if n .RE .sp This is for sanity/safety/security reasons, we apologize for the inconvenience. .RE .sp .RS 4 Run actions remotely via ssh. Either: .sp .if n .RS 4 .nf .fam C ssh:/// : .fam .fi .if n .RE .sp If a \fI\fP is specified, btrbk actions for \fI\fP (shell commands) are executed via ssh, using the "ssh_" options described below. .sp Note that btrbk keeps mountpoint and btrfs\-tree information per \fIhostname\fP: specifying different \fIssh_port\fP for the same host, e.g. for several virtual machines listening on same address, will NOT work. If you need this, define alias host names for each vm. .RE .SH "OPTIONS" .sp The options described here can be specified in \fIglobal context\fP as well as \fIvolume\fP, \fIsubvolume\fP and \fItarget\fP sections, unless stated otherwise. .SS "Basic Options" .sp \fBtimestamp_format\fP short|long|long\-iso .RS 4 Timestamp format used as postfix for new snapshot subvolume names. Defaults to \(lqshort\(rq. .sp \fBshort\fP .RS 4 \f(CRYYYYMMDD[_N]\fP (e.g. "20150825", "20150825_1") .RE .sp \fBlong\fP .RS 4 \f(CRYYYYMMDDhhmm[_N]\fP (e.g. "20150825T1531") .RE .sp \fBlong\-iso\fP .RS 4 \f(CRYYYYMMDDhhmmss±hhmm[_N]\fP (e.g. "20150825T153123+0200") .RE .sp Note that a postfix "_N" is appended to the timestamp if a snapshot or backup already exists with the timestamp of current date/time. .sp Use \(lqlong\-iso\(rq if you want to make sure that btrbk never creates ambiguous time stamps (which can happen if multiple snapshots are created during a daylight saving time clock change). .sp Note that using \(lqlong\-iso\(rq has implications on the scheduling, see RETENTION POLICY (caveats) below. .RE .sp \fBsnapshot_dir\fP .RS 4 Directory in which the btrfs snapshots are created, relative to \fI\fP of the \fIvolume\fP section. Note that btrbk does not autmatically create this directory, and the snapshot creation will fail if it is not present. .RE .sp \fBsnapshot_name\fP .RS 4 Base name of the created snapshot (and backup). This option is only valid in the \fIsubvolume\fP section. Defaults to \fI\fP. .RE .sp \fBsnapshot_create\fP always|onchange|ondemand|no .RS 4 If set to \(lqalways\(rq, snapshots are always created. If set to \(lqonchange\(rq, snapshots are only created if the source subvolume has changed since the last snapshot (more precisely: if the btrfs generation has been increased since the last snapshot). If set to \(lqondemand\(rq, snapshots are only created if at least one target subvolume is reachable (useful if you are tight on disk space and you only need btrbk for backups to an external disk which is not always connected). If set to \(lqno\(rq, the snapshots are never created (useful if another instance of btrbk is taking care of snapshot creation). Defaults to \(lqalways\(rq. .RE .sp \fBincremental\fP yes|no|strict .RS 4 If set, incremental backups are created. If set to \(lqstrict\(rq, non\-incremental (initial) backups are never created. Defaults to \(lqyes\(rq. .RE .SS "Grouping Options" .sp \fBgroup\fP [,]... .RS 4 Add the current section (volume, subvolume or target) to a user\-defined group, which can be used as filter for most btrbk commands. This option can be set multiple times within the same context. .RE .SS "Retention Policy Options" .sp \fBpreserve_day_of_week\fP monday|tuesday|...|sunday .RS 4 Defines on what day a snapshot/backup is considered to be a "weekly" backup. Weekly, monthly and yearly backups are preserved on this day of week (see RETENTION POLICY below). Defaults to \(lqsunday\(rq. .RE .sp \fBpreserve_hour_of_day\fP [0..23] .RS 4 Defines after what time (in full hours since midnight) a snapshot/backup is considered to be a "daily" backup. Daily, weekly, monthly and yearly backups are preserved on this hour (see RETENTION POLICY below). If you set this option, make sure to also set \fItimestamp_format\fP to \(lqlong\(rq or \(lqlong\-iso\(rq (backups and snapshots having no time information will ignore this option). Defaults to \(lq0\(rq. .RE .sp \fBsnapshot_preserve\fP no| .RS 4 Set retention policy for snapshots (see RETENTION POLICY below). If set to \(lqno\(rq, preserve snapshots according to \fIsnapshot_preserve_min\fP only. Defaults to \(lqno\(rq. .RE .sp \fBsnapshot_preserve_min\fP all|latest|{h,d,w,m,y} .RS 4 Preserve all snapshots for a minimum amount of hours (h), days (d), weeks (w), months (m) or years (y), regardless of how many there are. If set to \(lqall\(rq, preserve all snapshots forever. If set to \(lqlatest\(rq, preserve latest snapshot. Defaults to \(lqall\(rq. .RE .sp \fBtarget_preserve\fP no| .RS 4 Set retention policy for backups (see RETENTION POLICY below). If set to \(lqno\(rq, preserve backups according to \fItarget_preserve_min\fP only. Defaults to \(lqno\(rq. .RE .sp \fBtarget_preserve_min\fP all|latest|no|{h,d,w,m,y} .RS 4 Preserve all backups for a minimum amount of hours (h), days (d), weeks (w), months (m) or years (y), regardless of how many there are. If set to \(lqall\(rq, preserve all backups forever. If set to \(lqlatest\(rq, always preserve the latest backup (useful in conjunction with "target_preserve no", if you want to keep the latest backup only). If set to \(lqno\(rq, only the backups following the \fItarget_preserve\fP policy are created. Defaults to \(lqall\(rq. .RE .sp \fBarchive_preserve\fP no| .RS 4 Set retention policy for archives ("btrbk archive" command), with same semantics as \fItarget_preserve\fP. .RE .sp \fBarchive_preserve_min\fP all|latest|no|{h,d,w,m,y} .RS 4 Set retention policy for archives ("btrbk archive" command), with same semantics as \fItarget_preserve_min\fP. .RE .sp \fBarchive_exclude\fP \fI*experimental*\fP .RS 4 Exclude subvolumes matching from archiving. The pattern accepts wildcard character "*", and is matched against the end of the pathname. .RE .SS "SSH Options" .sp \fBssh_identity\fP .RS 4 Absolute path to a ssh identity file (private key). Note that if the private key is password protected, btrbk will prompt for user input, which is usually not desired. .RE .sp \fBssh_user\fP .RS 4 Remote username for ssh. Defaults to \(lqroot\(rq. Make sure the remote user is able to run "btrfs" with root privileges (see option \fIbackend\fP for details). .RE .sp \fBssh_port\fP |default .RS 4 Port to connect to on the remote host. Defaults to \(lqdefault\(rq (the port specified in \fIssh_config\fP, which defaults to 22). .sp Note that btrbk keeps mountpoint and btrfs\-tree information per \fIhostname\fP: specifying different \fIssh_port\fP for the same host, e.g. for several virtual machines listening on same address, will NOT work. If you need this, define alias host names for each vm. .RE .sp \fBssh_compression\fP yes|no .RS 4 Enables or disables the compression of ssh connections. Defaults to \(lqno\(rq. .RE .sp \fBssh_cipher_spec\fP .RS 4 Selects the cipher specification for encrypting the session (comma\-separated list of ciphers in order of preference). See the "\-c cipher_spec" option in ssh(1) for more information. Defaults to \(lqdefault\(rq (the ciphers specified in \fIssh_config\fP). .RE .SS "Data Stream Options" .sp \fBstream_compress\fP |no .RS 4 Compress the btrfs send stream before transferring it from/to remote locations. Defaults to \(lqno\(rq. If enabled, make sure that \fI\fP is available on the source and target hosts. Supported \fI\fP: gzip, pigz, bzip2, pbzip2, xz, lzo, lz4. .RE .sp \fBstream_compress_level\fP default| .RS 4 Compression level for the specified \fI\fP. Refer to the related man\-page for details (usually [1..9], where 1 means fastest compression). Defaults to \(lqdefault\(rq (the default compression level of \fI\fP). .RE .sp \fBstream_compress_threads\fP default| .RS 4 Number of threads to use for . Only supported for "pigz", "pbzip2" and recent versions of "xz". .RE .sp \fBstream_buffer\fP |no .RS 4 Add a buffer to the btrfs send stream (in front of "btrfs receive"), with a maximum size of \fI\fP. This can give a speed improvement (measured up to 20%) on both local or remote operations, but also increases system load. A suffix of "k", "m", "g", or "%" can be added to \fI\fP to denote kilobytes (*1024), megabytes, gigabytes, or a percentage of total physical memory. Defaults to \(lqno\(rq. If enabled, make sure that the "mbuffer" command is available on the target host. .RE .sp \fBrate_limit\fP |no .RS 4 Limit the transfer to a maximum of \fI\fP bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote kilobytes (*1024), megabytes, and so on. Defaults to \(lqno\(rq. If enabled for remote sources, make sure that the "pv" command is available on the source host. .RE .SS "System Options" .sp \fBtransaction_log\fP |no .RS 4 If set, all transactions (snapshot create, subvolume send\-receive, subvolume delete) as well as abort messages are logged to , in a space\-separated table format: "localtime type status target_url source_url parent_url message". .RE .sp \fBtransaction_syslog\fP |no .RS 4 If set, all transactions (as described in \fItransaction_log\fP above) are logged to syslog. The program name used in the messages is "btrbk". Accepted parameters for \fI\fP: user, mail, daemon, auth, lpr, news, cron, authpriv, local0..local7. .RE .sp \fBlockfile\fP |no .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. Ignored on dryrun (\fI\-n\fP, \fI\-\-dry\-run\fP). See also \fI\-\-lockfile\fP command\-line option. .RE .sp \fBbackend\fP btrfs\-progs|btrfs\-progs\-btrbk|btrfs\-progs\-sudo .RS 4 Backend filesystem utilities to be used for btrfs specific operations. Defaults to \(lqbtrfs\-progs\(rq. .sp btrfs\-progs .RS 4 Default backend, btrfs commands are called as specified in btrfs(8) (e.g. "btrfs subvolume show"). .RE .sp btrfs\-progs\-btrbk .RS 4 btrfs commands are separated by a dash instead of a whitespace (e.g. "btrfs\-subvolume\-show" instead of "btrfs subvolume show"). Useful for setting suid or file capabilities (setcap) on specific btrfs commands, as implemented in .URL "https://github.com/digint/btrfs\-progs\-btrbk" "" "." .RE .sp btrfs\-progs\-sudo .RS 4 btrfs commands are prefixed with "sudo \-n" (e.g. "sudo \-n btrfs subvolume show" instead of "btrfs subvolume show"). Make sure to have appropriate (root) permissions for the "btrfs" command groups and the "readlink" command in /etc/sudoers. .RE .sp For convenience, it is also possible to set \fBbackend_local\fP or \fBbackend_remote\fP options, which will override the backend only for local or remote sources/targets (e.g. "backend_remote btrfs\-progs\-btrbk"). .RE .SS "Btrfs Specific Options" .sp \fBbtrfs_commit_delete\fP after|each|no .RS 4 If set, make sure the deletion of snapshot and backup subvolumes are committed to disk when btrbk terminates. Defaults to \(lqno\(rq. .RE .sp \fBsnapshot_qgroup_destroy\fP yes|no \fI*experimental*\fP .RS 4 .RE .sp \fBtarget_qgroup_destroy\fP yes|no \fI*experimental*\fP .RS 4 .RE .sp \fBarchive_qgroup_destroy\fP yes|no \fI*experimental*\fP .RS 4 Whenever a subvolume is deleted, also destroy corresponding default qgroup "\f(CR0/\fP". Only useful if you have enabled btrfs quota support. See also: .URL "https://bugzilla.kernel.org/show_bug.cgi?id=91751" "" "" .RE .SH "RETENTION POLICY" .sp btrbk uses separate retention policies for snapshots and backups, which are defined by the \fIsnapshot_preserve_min\fP, \fIsnapshot_preserve\fP, \fItarget_preserve_min\fP, \fItarget_preserve\fP, \fIpreserve_day_of_week\fP and \fIpreserve_hour_of_day\fP configuration options. .sp Within this section, any statement about "backups" is always valid for backups as well as snapshots, referring to \fItarget_preserve\fP or \fIsnapshot_preserve\fP respectively. .sp The format for \fI\fP is: .sp .if n .RS 4 .nf .fam C [h] [d] [w] [m] [y] .fam .fi .if n .RE .sp With the following semantics: .sp \fBhourly\fP .RS 4 Defines how many hours back hourly backups should be preserved. The first backup of an hour is considered an hourly backup. Note that if you use scheduling, make sure to also set \fItimestamp_format\fP to \(lqlong\(rq or \(lqlong\-iso\(rq, or the scheduler will interpret the time as "00:00" (midnight). .RE .sp \fBdaily\fP .RS 4 Defines how many days back daily backups should be preserved. The first backup of a day (starting at \fIpreserve_hour_of_day\fP) is considered a daily backup. .RE .sp \fBweekly\fP .RS 4 Defines how many weeks back weekly backups should be preserved. The first daily backup created at \fIpreserve_day_of_week\fP (or the first backup in this week if none was made on the exact day) is considered as a weekly backup. .RE .sp \fBmonthly\fP .RS 4 Defines how many months back monthly backups should be preserved. Every first weekly backup in a month is considered a monthly backup. .RE .sp \fByearly\fP .RS 4 Defines for how many years back yearly backups should be preserved. Every first monthly backup in a year is considered a yearly backup. .RE .sp Use an asterisk for \(lqall\(rq (e.g. "target_preserve 60d *m" states: "preserve daily backups for 60 days back, and all monthly backups"). .sp The reference time (which defines the beginning of a day, week, month or year) for all date/time calculations is the local time of the host running btrbk. .sp Hint: Run btrbk with the \fI\-S\fP, \fI\-\-print\-schedule\fP option to get a comprehensive output of the scheduler results. .sp Caveats: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ . sp -1 . IP \(bu 2.3 .\} If you run a setup with several btrbk instances (e.g. one snapshot\-only instance per remote client, and a separate fetch\-only instance on the backup server), it makes perfectly sense to run btrbk with different local time on the clients, in order to make sure the backups from all the remote hosts are preserved for "midnight", and not at "00:00 UTC" (which would be "14:00" in Honolulu). If you want this behaviour, do NOT use "timestamp_format long\-iso". .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ . sp -1 . IP \(bu 2.3 .\} If "timestamp_format long\-iso" is set, running btrbk from different time zones leads to different interpretation of "first in day, week, month, or year". Make sure to run btrbk with the same time zone on every host, e.g. by setting the TZ environment variable (see tzset(3)). .RE .SH "TARGET TYPES" .sp \fBsend\-receive\fP .RS 4 Backup to a btrfs filesystem, using "btrfs send/receive". This is the recommended (standard) target type. The \fI\fP must be an absolute path and point to a btrfs volume (or subvolume), or to a directory within a subvolume. See btrfs\-send(8), btrfs\-receive(8). .RE .sp \fBraw\fP \fI*experimental*\fP .RS 4 Backup to a raw (filesystem independent) file from the output of btrfs\-send(8), with optional compression and encryption. .sp Note that the target preserve mechanism is currently disabled for incremental raw backups (btrbk does not delete any incremental raw files)! .sp Raw backups consist of two files: the main data file containing the btrfs send stream, and a sidecar file ".info" containing metadata: .sp .if n .RS 4 .nf .fam C .[_N].btrfs[.gz|.bz2|.xz][.gpg] .[_N].btrfs[.gz|.bz2|.xz][.gpg].info .fam .fi .if n .RE .sp For \fIincremental\fP backups ("incremental yes"), please note that: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ . sp -1 . IP \(bu 2.3 .\} As soon as a single \fIincremental\fP backup file is lost or corrupted, all later incremental backups become invalid, as there is no common parent for the subsequent incremental images anymore. This might be a good compromise for a vacation backup plan, but for the long term make sure that a non\-incremental backup is triggered from time to time. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ . sp -1 . IP \(bu 2.3 .\} There is currently no support for rotation of incremental backups: if \fIincremental\fP is set, a full backup must be triggered manually from time to time in order to be able to delete old backups. .RE .sp Additional options for raw targets: .sp \fBraw_target_compress\fP |no .RS 4 Compression algorithm to use for raw backup target. Supported \fI\fP: gzip, pigz, bzip2, pbzip2, xz, lzo, lz4. .RE .sp \fBraw_target_compress_level\fP default| .RS 4 Compression level for the specified . .RE .sp \fBraw_target_compress_threads\fP default| .RS 4 Number of threads to use for . .RE .sp \fBraw_target_split\fP |no .RS 4 \: Split the raw backup file into pieces of size \fI\fP. .RE .sp \fBraw_target_block_size\fP .RS 4 Block size to use for writing the raw backup file. Defaults to \(lq128K\(rq. .RE .sp \fBraw_target_encrypt\fP gpg|openssl_enc|no .RS 4 If enabled, encrypt the target raw file using gpg or openssl_enc. .RE .sp Additional options for "raw_target_encrypt gpg": .sp \fBgpg_keyring\fP .RS 4 Keyring to use for gpg, e.g. "\f(CR/etc/btrbk/gpg/pubring.kbx\fP". .RE .sp \fBgpg_recipient\fP .RS 4 Encrypt for user id \fI\fP (email address). .RE .sp Additional options for "raw_target_encrypt openssl_enc" (\fIvery experimental\fP): .sp \fBopenssl_ciphername\fP\~ .RS 4 Defaults to \(lqaes\-256\-cbc\(rq. .RE .sp \fBopenssl_iv_size\fP |no .RS 4 Depends on selected cipher. .RE .sp \fBopenssl_keyfile\fP |no .RS 4 Point to a key file in hex (absolute path). Example key file creation (256bit key): .sp .if n .RS 4 .nf .fam C # dd if=/dev/urandom bs=1 count=32 \(rs | od \-x \-A n \(rs | tr \-d "[:space:]" > /path/to/keyfile .fam .fi .if n .RE .RE .sp \fBkdf_backend\fP |no .RS 4 KDF backend to be executed, e.g. "\f(CR/usr/share/btrbk/scripts/kdf_pbkdf2.py\fP". .RE .sp \fBkdf_keysize\fP .RS 4 Defaults to \(lq32\(rq. .RE .sp \fBkdf_keygen\fP once|each .RS 4 Defaults to \(lqonce\(rq. .RE .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\fP(1) .SH "AUTHOR" .sp Axel Burri <\c .MTO "axel\(attty0.ch" "" ">"