Having discovered that systemd can even be used as a replacement for Cron, I'm migrating most of my maintenance scripts to systemd Timers.

Here's how to have your BTRFS volumes scrubbed using parameterized units:

Service Unit


Description=Scrub BTRFS filesystem (%i)

ExecStart=/usr/bin/btrfs scrub start -B $mountpoint

Timer Unit


Description=Trigger BTRFS scrub on filesystem (%i)




In order to have a volume (e.g. your home partition) scrubbed you simply activate the timer...

$ systemctl enable btrfs-scrub@home.timer

... and specify the mount point in the corresponding configuration file, in this case /etc/conf.d/btrfs-scrub-home:


The configuration file seems a bit superfluous here, but AFAIK there's no way to supply filesystem paths via service@-suffix.

Note that these units do not include any form of notification in case of a scrubbing fail! I personally don't need this as my logs are monitored using journalcheck.

Update 2015-07-12: Changed unit type to 'simple' to make it compatible with long-running machines.

(updated on Sun 12 July 2015)