LinuxCommandLibrary

btrbk

Backup and restore Btrfs subvolumes

TLDR

Print statistics about configured subvolumes and snapshots

$ sudo btrbk stats
copy

List configured subvolumes and snapshots
$ sudo btrbk list
copy

Print what would happen in a run without making the displayed changes
$ sudo btrbk [[-v|--verbose]] dryrun
copy

Run backup routines verbosely, show progress bar
$ sudo btrbk --progress [[-v|--verbose]] run
copy

Only create snapshots for configured subvolumes
$ sudo btrbk snapshot
copy

SYNOPSIS

btrbk [options] [{dry-run|run|list|forget|clean|send|receive|validate}] [configfile]

PARAMETERS

-c FILE, --config FILE
    Load configuration from FILE (default: /etc/btrbk/btrbk.conf)

-v, --verbose
    Increase verbosity (repeatable for more output)

-q, --quiet
    Suppress non-essential output

-n, --dry-run
    Simulate actions without changes

-p, --print-only
    Print btrfs send streams instead of piping

-z, --progress
    Show transfer progress

-D LEVEL, --debug LEVEL
    Set debug level (0-4)

-l SEC, --lockfile-timeout SEC
    Lockfile timeout in seconds (default: 3600)

--keep-inc-req SIZE
    Minimum incremental backup size requirement

--target preserve_uid_gid
    Preserve UID/GID on remote targets

--snapshot_dir PATH
    Override snapshot directory (per-volume)

DESCRIPTION

btrbk is a lightweight, command-line backup utility designed specifically for BTRFS filesystems. It excels at creating atomic snapshots of subvolumes and generating incremental backups using BTRFS's native send and receive features, minimizing storage usage and transfer times.

Key capabilities include local and remote backups over SSH, customizable retention policies based on date, count, or volume, and automated cleanup of old snapshots. Configuration is declarative via simple text files, defining sources, targets, and schedules. btrbk supports multiple backup targets like local disks or remote servers, with built-in locking to prevent concurrent runs.

It's ideal for servers, NAS, or desktops needing reliable, space-efficient backups without proprietary tools. No daemon required; runs via cron or systemd timers. Ensures data integrity through BTRFS checksums and allows easy restoration via btrfs subvolume operations.

CAVEATS

Requires BTRFS kernel & tools (>=3.12). Snapshots non-bootable by default; use send-receive mode carefully over networks. No encryption/compression built-in (use BTRFS features). Config syntax sensitive to indentation.

SUBCOMMANDS

run: Execute backups (default).
dry-run: Preview.
list: Show snapshots.
forget: Delete per retention.
clean: Remove unnamed snapshots.

CONFIG BASICS

INI-like format:
volume /
snapshot_dir /backup/snapshots
target ssh:myserver:/backup
snapshot_dir . retention daily 7 weekly 4

HISTORY

Developed by Axel Wetter starting 2011; initial release 0.10 in 2012. Actively maintained, current versions (2.10+) support modern BTRFS features like RAID, compression. Popular in Linux communities for reliable backups.

SEE ALSO

btrfs(8), snapper(8), rsync(1), ssh(1)

Copied to clipboard