systemd: Enable irregularly regular btrfs balances

This commit is contained in:
Aminda Suomalainen 2024-09-03 13:42:52 +03:00
parent 6473b62bb3
commit 83dc96181f
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
4 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,4 @@
[Service]
# https://superuser.com/a/1290109
ExecStartPre=-/usr/sbin/btrfs balance start -dusage=25 -dlimit=10 -musage=25 -mlimit=10 /
ExecStartPost=-/usr/sbin/btrfs balance start -dusage=50 /

View File

@ -8,6 +8,7 @@ TimeoutStartSec=infinity
# Another attempt at ensuring Yggdrasil works with nordvpnd
ExecStartPre=-/usr/bin/systemctl enable --now aminda-nocron-reboot.service
ExecStartPre=-/usr/bin/systemctl enable --now aminda-nocron-reboot.timer
ExecStartPre=-/usr/bin/systemctl enable --now monthly-btrfs-balance.timer
ExecStartPre=-/usr/sbin/sysctl net.ipv6.conf.all.disable_ipv6=0
ExecStartPre=-/usr/bin/systemctl enable --now tlp
ExecStart=-/usr/bin/systemctl restart yggdrasil.service

View File

@ -0,0 +1,13 @@
[Unit]
Description=Monthly BTRFS full balancing
[Service]
Type=oneshot
TimeoutStartSec=infinity
ExecStart=/usr/sbin/btrfs balance start --full-balance /
User=root
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=Run full BTRFS balancing monthly
[Timer]
OnCalendar=monthly
Persistent=true
RemainAfterElapse=false
[Install]
WantedBy=timers.target