util-linux/sys-utils/fstrim.timer
Luca BRUNO dac72b6e7e
fstrim: run service and timer only if /etc/fstab is present
The timer and service units run `fstrim --fstab`, which strictly
depends on `/etc/fstab` being present in the OS. This adds relevant
condition statements to the units, in order to skip them and avoid
runtime failures.

Ref: https://github.com/karelzak/util-linux/issues/673#issuecomment-409246816
Ref: https://github.com/coreos/bugs/issues/2591
Ref: https://github.com/coreos/fedora-coreos-tracker/issues/468

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2020-04-27 10:08:53 +00:00

14 lines
260 B
SYSTEMD

[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim
ConditionPathExists=/etc/fstab
ConditionVirtualization=!container
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
RandomizedDelaySec=6000
[Install]
WantedBy=timers.target