Skip to main content

what

performs incremental backups with rsync onto a btrfs filesystem. finished backups are retained as read-only snapshots.

usage

install

pip install snapshotbackup
pip install snapshotbackup[ci]          # install ci related dependencies
pip install snapshotbackup[dev]         # install dev dependencies
pip install snapshotbackup[journald]    # enable logging to journald with `--silent`

example config.ini

[DEFAULT]
; retain_all = '1 day'
; retain_daily = '1 month'
; decay = '1 year'

[data1]
source = /path/to/data1
backups = /backups/data1

[data2]
source = /path/to/data2
backups = /backups/data2
ignore = /.cache
retain_all = '1 week'
; '1', 'true' or 'True' for `True`, everything else is `False`
autodecay = 1
autoprune = true

actions

the setup-step can be skipped if configured backup directory already exists.

snapshotbackup setup data1
snapshotbackup backup data1
snapshotbackup list data1
snapshotbackup prune data1
snapshotbackup decay data1

retention policy

prune will preserve:

  • all backups not older than retain_all
  • daily backups not older than retain_daily
  • weekly backups forever (see decay)
  • the latest backup is always preserved

decay removes all backups older than configured decay.

automatization

when using advanced installation methods and cron make sure PATH is properly setup, f.e.

PATH=/usr/local/bin:/bin:/usr/bin:/home/foo/.local/bin
01 * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus snapshotbackup backup home -s

to allow non-interactive deletions configure sudo to allow your user "foo" to use some btrfs commands without password.

foo ALL=(ALL) NOPASSWD: /usr/bin/btrfs subvolume list *
foo ALL=(ALL) NOPASSWD: /usr/bin/btrfs subvolume delete *

dev env

virtualenv .env -p python3
. .env/bin/activate
pip install -e .[dev]  # or pip install -e .[dev,journald]

on zsh you may need to quote:

pip install -e ".[dev]"

demo

if you don't have a btrfs filesystem at hand checkout the demo folder. it creates a btrfs image file and mounts it as loopback device.

DISCLAIMER: i'm not sure if btrfs loopback files are safe in every environment. use at your own risk.

make -f makefile.demo setup
make -f makefile.demo backup
make -f makefile.demo list
make -f makefile.demo prune
make -f makefile.demo decay
make -f makefile.demo clean

please read makefile.demo and demo/config.ini to understand what's happening.

build

./setup.py bdist_wheel

that's all

not enough documentation? well, erm.., intended audience are developers. that's what you get for hobby projects ;-)

Metadata

Release files for snapshotbackup 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapshotbackup 0.0.19
File Size Uploaded
snapshotbackup-0.0.19.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snapshotbackup 0.0.19
File Interpreter ABI Platform
snapshotbackup-0.0.19-py3-none-any.whl Python 3 none any Details

Total release size: 45.4 kB

Release files / snapshotbackup-0.0.19.tar.gz

Download URL snapshotbackup-0.0.19.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4562f8d6b3c936894a2817d3ad727c81ff1bcaad54d101ff73c4ef0bc2ea0286
BLAKE2b-256 checksum
How to use checksums
95909183306cc8ec14d211cf062678af60d4a01811ac6820c4268ecea12f2fc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Release files / snapshotbackup-0.0.19-py3-none-any.whl

Download URL snapshotbackup-0.0.19-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f061dc6a33d9c41aa79882219f3156b57f2bc8a581afc762656c5e88e1166637
BLAKE2b-256 checksum
How to use checksums
944ba2bf113558ec250a6d532455f9eaa4be87726fd5d193a90b785403ad951e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.19 This release

2 release files

0.0.17

2 release files

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page