Skip to content

adamreichold/b2_backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

b2_backup

This program can be used to perform incremental backups of a given set of files and directories targeting Backblaze B2 for storage. It uses the bup block splitting algorithm and keeps a local manifest in an SQLite database. It uses BLAKE3 for block addressing, Zstd for compression and the extended nonce variant of ChaCha20-Poly1305 for authenticated encryption.

During normal operation, it will only upload additional block archives and manifest patchsets, but it will not download any objects from the B2 bucket. Sometimes, it will automatically download objects containing stale data and merge those into new archives and patchsets to reduce the remote space usage.

Configuration

By default, the configuration file config.yaml and the manifest databse manifest.db are assumed to be found in the current working directory.

A full example configuration including the optional items is:

# B2 application key ID
app_key_id: 'aaaaaaaaaaaaaaaaaaaaaaaaa'
# B2 application key
app_key: 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'
# B2 bucket ID
bucket_id: 'cccccccccccccccccccccccc'
# B2 bucket name
bucket_name: 'foo'
# pack file encryption key
key: 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
# paths which are recursively included
includes:
  - /home/bar
# path which are skipped if encountered (optional)
excludes:
  - /home/bar/.cache
# whether deleted files are removed from backup (optional)
keep_deleted_files: false
# number of threads used to split and hash blocks and compress archives (optional)
num_threads: 4
# compression level used for pack files (optional)
compression_level: 17
# minimum amount of block data before an new archive file is created (optional)
min_archive_len: 50_000_000
# maximum resulting size when merging patchset files (optional)
max_manifest_len: 10_000_000
# threshold above which collecting archives containing stale data starts (zero deactivates mechanism, optional)
small_archives_upper_limit: 10
# threshold below which collecting archives containing stale data stops (optional)
small_archives_lower_limit: 5
# threshold at which patchsets containing stale data are collected (zero deactivates mechanism, optional)
small_patchsets_limit: 25

The B2 application key and the B2 bucket need to be created manually.

The systemd folder contains a timer and service which can be used to automatically and persistently run this program each day after placing the binary into $HOME/bin/b2_bacup, the unit files into $HOME/.config/systemd/user and running systemctl --user enable --now b2_backup.timer.