Btrbk

btrbk is a tool for creating incremental snapshots and remote backups of Btrfs subvolumes. You can use it for simple backups to an external hard drive as well as more complex scenarios, like a server pulling the backups from all computers in the network. Or you can just use it to make local snapshots to protect against accidental deletions.

Terminology
Snapshots are locally (on the same filesystem) stored Btrfs snapshots, backups are snapshots copied to a folder or over SSH and archives are extra copies of backups.

Configuration
A commented example configuration file is found in. Refer to the man page for more details.

With the example configuration above, btrbk will only create snapshots (in ) if the data has changed. The  timestamps include the time in addition to the date.

The  keywords mean that:


 * Snapshots are kept for 7 days, up to 24 hourly and 7 daily snapshots
 * There will be no hourly backups stored, daily backups will be deleted after 14 days, weekly backups after 6 weeks, monthly backups after 4 months and yearly backups after 1 year
 * When you archive your backup, only 1 daily, weekly, monthly and yearly snapshot will be kept
 * The newest snapshot/backup/archive will always be kept, because  is set to

The example assumes that the btrfs subvolume containing @root and @home is mounted at. This is usually the btrfs root subvolume, which always has.

Create the directory for the snapshots and test the configuration:

Backups
To be able to create backups you need to add a :

Pull backups from remote computers
To be able to pull backups from several computers to a file server you need something like this on the server:

For more examples, take a look at the official documentation hyperlinked at the top right of this page.

SSH configuration
If you want to backup to or from a remote computer via SSH, you have to generate a key and add it to  on the targets.

You might want to restrict the IPs/IP ranges from where root can log in. To do that, you can use the  keyword. Consult the man page for sshd_config for details.

Usage
To create snapshots and backup them (if a target was configured), run:

To only create snapshots even if a target is configured, run: