This script is based on the Chronial/snapraid-runner project and runs snapraid-btrfs, sending its output to the console, a log file and via email. All this is configurable.
It can be run manually, but its main purpose is to be run via cronjob or systemd unit.
Given the use of the BTRFS filesystem, this script is only supported on Linux. It requires at least python3.7.
- If you don’t already have it, download and install the latest python version.
- Clone this repository via git.
- Copy/rename the
snapraid-btrfs-runner.conf.example
tosnapraid-btrfs-runner.conf
and edit its contents. You need to at least configure the following configuration items:snapraid-btrfs.executable
snapper.executable
snapraid.executable
snapraid.config
- Run the script via
python3 snapraid-btrfs-runner.py
.
See the init dir for a sample systemd timer for automatic scheduled runs.
Includes all the snapraid-runner features:
- Runs
diff
beforesync
to see how many files were deleted and aborts if that number exceeds a set threshold. - Can create a size-limited rotated logfile.
- Can send notification emails after each run or only for failures.
- Can run
scrub
aftersync
Includes basic snapraid-btrfs features of taking BTRFS snapshots in conjunction with snapraid operations (i.e.
diff
, sync
, cleanup
, and scrub
). This script omits access to many underlying snapraid-btrfs options, given its intended
use as an unattended automatic snapraid tool. Features include:
- Uses
snapraid-btrfs
fordiff
,sync
, andscrub
operations - Can run
pool
and/orcleanup
betweensync
andscrub
- Nothing for now
- Incorporated fixes from the upstream snapraid-runner project:
- Add
--ignore-deletethreshold
(by exterrestris, #25) - Add support for scrub
--plan
, replacing--percentage
- Remove snapraid progress output. Was accidentially introduced with python3 support.
- Add
- Initial release
- Added optional
snapraid-btrfs pool
andsnapraid-btrfs cleanup
step aftersync
- Added config options for for
--snapper-configs
and--snapper-configs-file
underlying options in snapraid-btrfs.