aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/systemd/system/btrfs-balance@.service13
-rw-r--r--etc/systemd/system/btrfs-balance@.timer12
2 files changed, 25 insertions, 0 deletions
diff --git a/etc/systemd/system/btrfs-balance@.service b/etc/systemd/system/btrfs-balance@.service
new file mode 100644
index 0000000..a81c58d
--- /dev/null
+++ b/etc/systemd/system/btrfs-balance@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Balance btrfs filesystem on %f (data/metadata <50%% block-group fill)
+Documentation=man:btrfs-balance(8)
+RequiresMountsFor=%f
+ConditionPathIsMountPoint=%f
+ConditionPathExists=/usr/bin/btrfs
+
+[Service]
+Type=oneshot
+Nice=19
+IOSchedulingClass=idle
+KillSignal=SIGINT
+ExecStart=/usr/bin/btrfs balance start -dusage=50 -musage=50 %f
diff --git a/etc/systemd/system/btrfs-balance@.timer b/etc/systemd/system/btrfs-balance@.timer
new file mode 100644
index 0000000..91a009c
--- /dev/null
+++ b/etc/systemd/system/btrfs-balance@.timer
@@ -0,0 +1,12 @@
+[Unit]
+Description=Monthly btrfs balance on %f
+Documentation=man:btrfs-balance(8)
+
+[Timer]
+OnCalendar=monthly
+AccuracySec=1d
+Persistent=true
+RandomizedDelaySec=1h
+
+[Install]
+WantedBy=timers.target