Skip to content

Instantly share code, notes, and snippets.

@Torstein-Eide
Forked from ricco386/btrfs-scrub-pictures
Created October 20, 2019 21:08
Show Gist options
  • Save Torstein-Eide/685837fc9eeb517599bb1b710e3818be to your computer and use it in GitHub Desktop.
Save Torstein-Eide/685837fc9eeb517599bb1b710e3818be to your computer and use it in GitHub Desktop.
Systemd timer for BTRFS Scrub. Usage: systemctl enable btrfs-scrub@pictures.timer
# /etc/btrfs.d/btrfs-scrub-volum1
mountpoint=/volum1
# /etc/systemd/system/btrfs-scrub@.service
[Unit]
Description=Scrub BTRFS filesystem (%i), check volume for errors
Documentation=man:btrfs-scrub
# After=fstrim.service
[Service]
Type=oneshot
EnvironmentFile=/etc/btrfs.d/btrfs-scrub-%i
ExecStart=/usr/sbin/btrfs scrub start -B $mountpoint
IOSchedulingClass=idle
CPUSchedulingPolicy=idle
# /etc/systemd/system/btrfs-scrub@.timer
[Unit]
Description=Trigger BTRFS scrub on filesystem (%i)
[Timer]
OnCalendar=monthly
Persistent=true
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment