BTRBK.CONF(5)
π BTRBK.CONF(5) β btrbk configuration file π
okay bestie, gather round, because this is the manual page for btrbk.conf, and it's the one that tells btrbk everything: which btrfs subvolumes we're messing with, where the snapshots go, where the backups land, and how long we keep them. No cap. π«Ά
β¨ SYNOPSIS β¨
/etc/btrbk.conf
/etc/btrbk/btrbk.conf
πΈ DESCRIPTION πΈ
So the btrbk configuration file is basically the group chat where you spell out which btrfs subvolumes on the filesystem are gonna get processed, what target subvolumes should be used to create the backups, and where the snapshots should be generated. The retention policy, plus most other options, can be defined either globally or within a section. Your choice, babe.
Here's the tea though: options always apply to the last section encountered, and they supersede whatever was set in upper-level sections. Which literally means global options have to be set before any sections are defined. Order matters, iykyk. π
Blank lines are ignored (they're just vibing). And a hash character (#) starts a comment that runs until the end of the line. π
π¦ SECTIONS π¦
volume <volume-directory>|<url> (optional)
An absolute path pointing to a btrfs file system containing the source subvolume(s) to be backed up. Usually the mount point of a btrfs filesystem mounted with the subvolid=5 option.
subvolume <subvolume-name>
The subvolume to be backed up β relative to the <volume-directory> of the volume section, or absolute if the volume section is omitted entirely. It accepts the wildcard character "*". β¨
Heads up bestie: if this subvolume is btrfs root (id=5), it needs to have a valid UUID, and that is not the case for file systems created withbtrfs-progs < 4.16. π
target [send-receive|raw] <target-directory>|<url>
The target directory where the backup subvolumes are to be created. The optional target type defaults to βsend-receiveβ β see TARGET TYPES below for the details.
You can have multiple target sections, in any context: a target defined in volume or global context will be used for all the underlying subvolume sections. (hint: run btrbk list or btrbk config print to see the resulting configuration β it's giving receipts, honestly).
If a <url> is specified, btrbk actions (shell commands) are executed remotely via ssh, using the SSH Options described below. The accepted formats are:
ssh://<hostname>[:<port>]/<directory>
<hostname>:<directory>
Where <hostname> is either a host name, an IPv4 address in dotted-decimal form, or an IP literal encapsulated within square brackets (e.g. "[2001:db8::7]"). π°οΈ
If you are connecting to virtual machines, consider configuring several volume sections for a <hostname>, with distinct <port> numbers for each machine. Very organized of you, honestly.
π OPTIONS π
The options described here can be specified in global context as well as volume, subvolume and target sections β unless stated otherwise.
π Basic Options π
timestamp_format short|long|long-isoβ The timestamp format used as postfix for new snapshot subvolume names. Defaults to βlongβ.shortβYYYYMMDD[_N](e.g."20150825","20150825_1")longβYYYYMMDD<T>hhmm[_N](e.g."20150825T1531")long-isoβYYYYMMDD<T>hhmmss±hhmm[_N](e.g."20150825T153123+0200")
Note that a postfix "_N" is appended to the timestamp if a snapshot or backup already exists with the timestamp of the current date/time. (Collision detection, she's smart. π§ )
Use βlong-isoβ if you want to make sure that btrbk never creates ambiguous time stamps β which can totally happen if multiple snapshots are created during a daylight saving time clock change. π
Also note that using βlong-isoβ has implications on the scheduling, see Reference Time below.
snapshot_dir <directory>β The directory in which the btrfs snapshots are created, relative to<volume-directory>of the volume section, or absolute if the volume section is omitted. Note that btrbk does not automatically create this directory, and the snapshot creation will fail if it is not present. Make the folder, bestie. Please.snapshot_name <basename>β The base name of the created snapshot (and backup). This option is only valid in thesubvolumesection. Defaults to<subvolume-name>.snapshot_create always|onchange|ondemand|noβ If set to βalwaysβ, snapshots are always created. If set to βonchangeβ, snapshots are only created if the last snapshot is not up-to-date, i.e. the source subvolume has changed (more precisely: the btrfs generation has been increased) since the last snapshot was created. If set to βondemandβ, 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 βnoβ, the snapshots are never created (useful if another instance of btrbk is taking care of snapshot creation). Defaults to βalwaysβ.incremental yes|no|strictβ If set, incremental backups are created. If set to βstrictβ, non-incremental (initial) backups are never created, and incremental backups are restricted to related parents (by parent-uuid relationship). Defaults to βyesβ.
Note that even if the parent-uuid chain is broken, snapshots and backups can still share data (which is especially true for backups created withincrementaloption enabled), and are perfectly suitable as parents for incremental send-receive operations. But as btrbk can not be certain about this, such operations are disallowed in"incremental strict"mode. π
noauto yes|noβ If set, the context is skipped by all btrbk actions unless explicitly enabled by a matchingbtrbk <filter>command line argument (e.g."btrbk run myfilter").
π Grouping Options π
group <group-name> [<group-name>]...β Add the current section (volume,subvolumeortarget) to user-defined groups, which can be used as filter for most btrbk commands (seebtrbk(1)FILTER STATEMENTS). This option can be set multiple times within the same context. β¨
π Retention Policy Options π
preserve_day_of_week monday|tuesday|...|sundayβ 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 βsundayβ.preserve_hour_of_day [0..23]β 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). Ignored on snapshots or backups without time information (timestamp_format short). Defaults to β0β.snapshot_preserve no|<retention_policy>β Set retention policy for snapshots (see RETENTION POLICY below). If set to βnoβ, preserve snapshots according tosnapshot_preserve_minonly. Defaults to βnoβ.
Note thatsnapshot_preservehas no effect ifsnapshot_preserve_minis set to βallβ (the default). π
snapshot_preserve_min all|latest|<number>{h,d,w,m,y}β 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 βallβ, preserve all snapshots forever. If set to βlatestβ, preserve latest snapshot. Defaults to βallβ.target_preserve no|<retention_policy>β Set retention policy for backups (see RETENTION POLICY below). If set to βnoβ, preserve backups according totarget_preserve_minonly. Defaults to βnoβ.
Note thattarget_preservehas no effect iftarget_preserve_minis set to βallβ (the default). Again. π
target_preserve_min all|latest|no|<number>{h,d,w,m,y}β 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 βallβ, preserve all backups forever. If set to βlatestβ, always preserve the latest backup (useful in conjunction with"target_preserve no", if you want to keep the latest backup only). If set to βnoβ, only the backups following thetarget_preservepolicy are created. Defaults to βallβ.archive_preserve no|<retention_policy>β Set retention policy for archives ("btrbk archive"command), with same semantics astarget_preserve.archive_preserve_min all|latest|no|<number>{h,d,w,m,y}β Set retention policy for archives ("btrbk archive"command), with same semantics astarget_preserve_min.archive_exclude <pattern>β Exclude subvolumes matching<pattern>from archiving. The pattern accepts wildcard character"*", and is matched against the end of the pathname. π«
π₯ SSH Options π₯
ssh_identity <file>|noβ Absolute path to a ssh identity file (private key). If not set, the ssh default is used (seessh(1),"-i identity_file"). Note that if the identity key is password protected and no authentication agent is used, btrbk will prompt for user input on every connection attempt. Every. Single. One. πssh_user <username>|noβ Remote username for ssh. Defaults to βrootβ. Make sure the remote user is able to run"btrfs"with root privileges (see optionbackendfor details). If set to βnoβ, the ssh default is used.ssh_compression yes|noβ Enables or disables the compression of ssh connections. Defaults to βnoβ.
Note that if stream_compress is enabled, ssh compression will always be disabled for send/receive operations.
ssh_cipher_spec default|<cipher_spec>β Selects the cipher specification for encrypting the session (comma-separated list of ciphers in order of preference). See the"-c cipher_spec"option inssh(1)for more information. Defaults to βdefaultβ (the ciphers specified inssh_config(5)). π
π Data Stream Options π
stream_compress <compress_command>|noβ Compress the btrfs send stream before transferring it from/to remote locations. Defaults to βnoβ. If enabled, make sure that<compress_command>is available on the source and target hosts. Supported<compress_command>:gzip,pigz,bzip2,pbzip2,bzip3,xz,lzo,lz4,zstd. ποΈstream_compress_level default|<number>β Compression level for the specified<compress_command>. Refer to the related man-page for details (usually[1..9], where1means fastest compression). Defaults to βdefaultβ (the default compression level of<compress_command>).stream_compress_long default|<number>β Enable long distance matching for the specified<compress_command>. Refer to the related man-page for details. Only supported for"zstd".stream_compress_threads default|<number>β Number of threads to use for<compress_command>. Only supported for"pigz","pbzip2","bzip3","zstd"and recent versions of"xz".stream_compress_adapt yes|noβ Enable adaptive compression for<compress_command>. Only supported for"zstd"(version >=1.3.6). Defaults to βnoβ.stream_buffer <size>|noβ okay bestie, this one adds a buffer to the btrfs send stream, and it's locally, on uncompressed data, with a maximum size of size. It can give a speed improvement (measured up to 20%) on both local or remote operations, but it also increases system load. A suffix of"k","m","g", or"%"can be added to size to denote kilobytes (*1024), megabytes, gigabytes, or a percentage of total physical memory. Defaults to βnoβ.
If enabled, make sure that the "mbuffer" command (at least version 20180505) is available on the host running btrbk. As of btrbk-0.29.0, mbuffer(1) is used for both rate_limit and stream_buffer options:
mbuffer [-m <stream_buffer>] [-r <rate_limit>]
Note that mbuffer(1) always reads defaults from "/etc/mbuffer.rc" and "~/.mbuffer.rc".
Leave this option disabled if your main concern is a stable backup process: while recent versions of mbuffer have proven reliable, it is often desirable to keep things simple rather than adding an additional, multi-threaded process to the command pipe.
stream_buffer_remote <size>|noβ this adds a buffer on remote hosts (either source or target). Defaults to βnoβ.
Enable this if you prefer buffering on the remote side, or even on both sides: reasons for this depend on available memory, disk and cpu performance (btrfs send/receive, compression), as well as networking constraints.
rate_limit <rate>|noβ limit the read rate of the btrfs send stream to rate bytes per second (locally, on uncompressed send stream). A suffix of"k","m","g", or"t"can be added to denote kilobytes (*1024), megabytes, and so on. Defaults to βnoβ. Note thatrate_limitimplicitly adds a stream buffer (seestream_bufferoption above).rate_limit_remote <rate>|noβ add rate limit on remote hosts (either source or target). Defaults to βnoβ. Note that it usually does not make much sense to enable bothrate_limitandrate_limit_remote.
π System Options π
transaction_log <file>|noβ if set, all transactions (snapshot create, subvolume send-receive, subvolume delete) as well as abort messages are logged to file, in a space-separated table format:"localtime type status target_url source_url parent_url message".transaction_syslog <facility>|noβ if set, all transactions (as described intransaction_logabove) are logged to syslog. The program name used in the messages is"btrbk". Accepted parameters for facility:user,mail,daemon,auth,lpr,news,cron,authpriv,local0..local7.lockfile <file>|noβ place an exclusive lock on file during program execution, usingflock(2). If the lock is held by another process, exit before running any actions. Ignored on dryrun (-n,--dry-run). See also--lockfilecommand-line option.backend <backend>β backend filesystem utilities to be used for btrfs specific operations. Available backends:btrfs-progsβ default backend, btrfs commands are called as specified inbtrfs(8)(e.g."btrfs subvolume show").btrfs-progs-btrbkβ 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 inhttps://github.com/digint/btrfs-progs-btrbk.btrfs-progs-sudoβ 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 as well as the"readlink"and"test"commands in/etc/sudoers.btrfs-progs-doasβ similar tobtrfs-progs-sudo, using prefix"doas -n".
If you want to set this option for local or remote hosts only, set backend_local or backend_remote (e.g. "backend_remote btrfs-progs-btrbk").
If you want to set this option for regular (non-root) user only, set backend_local_user.
compat <compat-option>...β enable compatibility options. Available compat-option:busyboxβ use busybox compatible commands, at the expense of slight overhead while reading filesystem information.ignore_receive_errorsexperimental β tellbtrfs-receive(8)to not terminate on errors by setting"--max-errors=0"option. Print warnings instead.
A known use case for this are target hosts lacking xattr support (e.g. some Synology NAS), while the send-stream contains "lsetxattr" commands. Another case is targets failing to set otime, complaining with "ERROR: attribute 12 requested but not present".
Note that there is no guarantee that backups created with this option enabled can be restored at all. π
If you want to set this option for local or remote hosts only, set compat_local or compat_remote (e.g. "compat_remote busybox").
cache_dir <directory>β if set, cache extent maps for the"btrbk extents"command.
π¦ Btrfs Specific Options π¦
incremental_prefs <list-spec>[:<amount>]...β specify the preferences to determine the best common (correlated) parent and clone sources for incremental backups, by choosing from predefined candidate lists.
The list-spec defines from what candidate list the next parent/clone-src should be appended to a result list; amount defines how many (e.g. "sro:1 sro:1" is identical to "sro:2"), or all if omitted. Any candidate which is already in the results is dropped.
The resulting list of subvolumes is then used as parameters for the btrfs-send(8) command: the first for "-p <parent>", all others for "-c <clone-src>".
Available list-spec (candidate lists = filtered subsets of correlated subvolumes):
sro,srnβ all fromsnapshot_dirmatchingsnapshot_name, withparent_uuidrelationship, sorted by btrbk timestamp (o=older n=newer).sao,sanβ all fromsnapshot_dirmatchingsnapshot_name, sorted by btrbk timestamp (o=older n=newer).aro,arnβ all fromincremental_resolve, withparent_uuidrelationship, sorted bycgen(o=older n=newer).
Defaults to "sro:1 srn:1 sao:1 san:1 aro:1 arn:1". Note that for most operations the default resolves a single parent, as there usually are no newer snapshots, and all "sro:1 sao:1 aro:1" resolve to the same snapshot.
Example: "defaults,sao,san,aro,arn" takes the defaults, and adds clone sources for all (!) known candidates on the filesystem.
incremental_clones yes|noβ if enabled, btrbk adds"-c <clone-src>"to thebtrfs-send(8)command for all correlated subvolumes resolved byincremental_prefs. If disabled, only"-p <parent>"is used. Defaults to βyesβ.incremental_resolve mountpoint|directoryβ specifies where to search for the best common parent for incremental backups. If set to βmountpointβ, use parents in the filesystem tree below the mount point of the snapshot and target directory. If set to βdirectoryβ, use parents strictly below snapshot/target directories. Set this to βdirectoryβ if you get access problems (when not running btrbk as root). Defaults to βmountpointβ.btrfs_commit_delete yes|noβ if set, wait for the transaction commit at the end of each snapshot or backup deletion (sets--commit-eachoption for"btrfs subvolume delete"). Defaults to βnoβ.send_protocol <number>|noexperimental β use btrfs send protocol version N. If enabled on target, btrbk adds"--proto <number>"to thebtrfs-send(8)command. Defaults to βnoβ (btrfs default).send_compressed_data yes|noexperimental β send data that is compressed on the filesystem directly without decompressing it. This requires protocol version 2 or higher (btrfs-progs >= 5.19), and implies"send_protocol 2". If enabled on target, btrbk adds"--compressed-data"to thebtrfs-send(8)command. Defaults to βnoβ (btrfs default).snapshot_qgroup_destroy yes|noexperimentaltarget_qgroup_destroy yes|noexperimentalarchive_qgroup_destroy yes|noexperimental β whenever a subvolume is deleted, also destroy corresponding default qgroup"0/<subvol-id>". Only useful if you have enabled btrfs quota support. See also:https://bugzilla.kernel.org/show_bug.cgi?id=91751
πΈ Informative Options πΈ
warn_unknown_targets yes|noβ if set, prints a warning if btrbk encounters a target subvolume at a unknown location (i.e. not following btrbk naming scheme, or outside the target directory). Defaults to βnoβ.
π RETENTION POLICY π
okay so retention policies? they're defined individually for snapshots, backups and archives (we're calling all of those "backups" from here on, bestie, keep up π ), and you build them out of a combo of these two:
*_preserve_min all|latest|no|<number>{h,d,w,m,y}β how much time (a duration) where every single backup gets preserved. no skips, no deletions, all of them.*_preserve no|<retention_policy>β a schedule (like, specific points in time) saying which individual backups get preserved.
heads up bestie: ifpreserve_minis set to βallβ (which is the default), then literally anypreservesetting you write has no effect. none. zero. it's giving decorative π
The format for <retention_policy> is:
[<hourly>h] [<daily>d] [<weekly>w] [<monthly>m] [<yearly>y]
hourlyβ how many hours back the hourly backups should be preserved. the first backup of an hour is the one that counts as an hourly backup. πdailyβ how many days back daily backups should be preserved. the first backup of a day (and a day starts atpreserve_hour_of_day) is what counts as a daily backup.weeklyβ how many weeks back weekly backups should be preserved. the first daily backup created atpreserve_day_of_weekcounts as the weekly backup (or, if nobody made one on that exact day, the first backup in that week takes the crown).monthlyβ how many months back monthly backups should be preserved. every first weekly backup in a month is considered a monthly backup.yearlyβ how many years back yearly backups should be preserved. every first monthly backup in a year is considered a yearly backup.
Use an asterisk for βallβ β like, for example, target_preserve 60d *m means: "preserve daily backups for 60 days back, and all monthly backups". iconic, honestly. β¨
hint bestie: run btrbk with the-S,--print-scheduleoption and you get a comprehensive output of the scheduler results. very satisfying to read, no cap.
β° Reference Time β°
The local time on the host running btrbk defines the reference time for all date/time calculations. especially for "beginning of a day", and as a consequence for the first daily, weekly, monthly or yearly backups. The local time on remote hosts (ssh source/target) is never used. periodt.
Unless timestamp_format long-iso is set, daily backups are preserved at preserve_hour_of_day (defaults to midnight) of the respective time zone (and not for "00:00 UTC", which would be "14:00" in Honolulu β the way that time zones will humble you π). This becomes relevant for setups with multiple btrbk instances, e.g. many snapshot-only instances (spread around the world π), and a fetch-only instance on the backup server.
Caveat:
- If
timestamp_format long-isois set, each btrbk instance has a different interpretation of "first in day". Make sure to run btrbk with the same time zone on every host, e.g. by setting theTZenvironment variable (seetzset(3)). fr fr, don't skip this one.
π¦ TARGET TYPES π¦
send-receiveβ backup to a btrfs filesystem, usingbtrfs send/receive. this is the recommended (standard) target type, the main character π«Ά. The<target-directory>must be an absolute path and point to a subvolume or directory within a btrfs file system. Seebtrfs-send(8),btrfs-receive(8).rawexperimental β backup to a raw (filesystem independent) file made from the output ofbtrfs-send(8), with optional compression and encryption.
note that the target preserve mechanism is currently disabled for incremental raw backups β btrbk does not delete any incremental raw files! π
Raw backups consist of two files: the main data file containing the btrfs send stream, and a sidecar file .info containing metadata:
<snapshot-name>.<timestamp>[_N].btrfs[.gz|.bz2|...][.gpg]
<snapshot-name>.<timestamp>[_N].btrfs[.gz|.bz2|...][.gpg].info
For incremental backups (incremental yes), please note that:
- As soon as a single incremental 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.
- There is currently no support for rotation of incremental backups: if incremental is set, a full backup must be triggered manually from time to time in order to be able to delete old backups.
Additional options for raw targets:
raw_target_compress <compress_command>|noβ compression algorithm to use for raw backup target. Supported<compress_command>:gzip,pigz,bzip2,pbzip2,bzip3,xz,lzo,lz4,zstd.raw_target_compress_level default|<number>β compression level for the specified<compress_command>.raw_target_compress_long default|<number>β enable long distance matching for the specified<compress_command>.raw_target_compress_threads default|<number>β number of threads to use for<compress_command>.raw_target_split <size>|noβ split the raw backup file into pieces of size<size>.raw_target_block_size <number>β block size to use for writing the raw backup file. Defaults to β128Kβ.raw_target_encrypt gpg|openssl_enc|noβ if enabled, encrypt the target raw file usinggpgoropenssl_enc. π
Additional options for raw_target_encrypt gpg:
gpg_keyring <file>β keyring to use for gpg, e.g."/etc/btrbk/gpg/pubring.kbx".gpg_recipient <name>...β encrypt for user id<name>(email address).
Additional options for raw_target_encrypt openssl_enc (very experimental):
openssl_ciphername <name>β defaults to βaes-256-cbcβ.openssl_iv_size <size-in-bytes>|noβ depends on selected cipher.openssl_keyfile <file>|noβ point to a key file in hex (absolute path). Example key file creation (256bit key):
# dd if=/dev/urandom bs=1 count=32 \
| od -x -A n \
| tr -d "[:space:]" > /path/to/keyfile
kdf_backend <file>|noβ KDF backend to be executed, e.g."/usr/share/btrbk/scripts/kdf_pbkdf2.py".kdf_keysize <size-in-bytes>β defaults to β32β.kdf_keygen once|eachβ defaults to βonceβ.
π AVAILABILITY π
Please refer to the btrbk project page https://digint.ch/btrbk/ for further details. go look bestie, it's right there π«Ά
β¨ SEE ALSO β¨
π AUTHOR π
Axel Burri axel@tty0.ch
and that's a wrap on this whole page, bestie!! π this beauty is Btrbk 0.32.7, dated 2026-07-19, and it's page BTRBK.CONF(5) β go forth and configure, you absolute icon πβ¨πΈ
π¦ where this page comes from
- arch rolling: btrbk 0.32.7-1 Β· GPL-3.0-or-later
- fedora 43: btrbk 0.32.7-1.fc43 Β· GPL-3.0-or-later
- fedora 44: btrbk 0.32.7-1.fc44 Β· GPL-3.0-or-later
- nixos 26.05: btrbk 0.32.7
- nixpkgs unstable: btrbk 0.32.7
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms