Commit Graph

8 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek cacd3e7685 fstrim: do not start the timer in initrd
I'm working on building initramfs images directly from normal
packages, which means that the pristine system rpms should behave
correctly as much as possible also in the initrd. There usually isn't
enough time for the timer to actually fire, but starting it gives a
line on the console and generally looks confusing and sloppy. So let's
skip the timer if it ever ends up being enabled in the initrd.

Checking for /etc/initrd-release is the standard condition that
systemd's initrd units use.
2021-05-21 10:45:35 +02:00
Dusty Mabe 9651b677f1
fstrim: remove fstab condition from fstrim.timer
In 9995da0 we added support to fstrim to be able to fall back to
`/proc/self/mountinfo` if `/etc/fstab` didn't exist, but we forgot
to remove the `/etc/fstab` condition from the timer. Let's remove
that condition from the timer so we can go back to periodically
running `fstrim.service`.
2020-10-13 11:28:07 -04:00
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
Sami Kerola f0158208a9
fstrim: randomize timer start time across 100 minutes
It should not matter when exactly fstrim runs, so spread these tasks across
time to help server farms and such to simultanously get busy with io.

Addresses: https://bugs.launchpad.net/bugs/1833593
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-15 15:24:01 +00:00
Eric Desrochers 0280d31a2b fstrim shouldn't run inside a container
Container type implies the following products:
openvz	OpenVZ/Virtuozzo
lxc	Linux container implementation by LXC
lxc-libvirt	Linux container implementation by libvirt
systemd-nspawn	systemd's minimal container implementation, see systemd-nspawn(1)
docker	Docker container manager
podman	Podman container manager
rkt	rkt app container runtime
wsl	Windows Subsystem for Linux

References:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
https://www.freedesktop.org/software/systemd/man/systemd-detect-virt.html#

Fix: #840

Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
2019-08-14 13:31:25 -04:00
Peter Hoeg 1a2e4a94fc fstrim: systemd timer units should be WantedBy=timers.target
[kzak@redhat.com: - this configuration is recommended by systemd docs]

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-12 10:30:36 +01:00
Karel Zak a39461d355 fstrim: daily -> weekly in systemd timer
* add link to fstrimg man page
 * less aggressive frequency

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-10 09:38:17 +02:00
Thomas Bächler 877cd8944b fstrim: add systemd units
This adds a timer and a service for systemd that runs
fstrim -a once a day.

The Persistent=true option used will only work on systemd 212
or newer.
2014-04-07 12:38:18 +02:00