Commit Graph

11 Commits

Author SHA1 Message Date
Karel Zak ef89802e83 fstrim: rename --quite to --quite-unsupported
We use --verbose together with --quite in service files. It seems
confusing, let's make the option more descriptive.

Addresses: https://github.com/karelzak/util-linux/issues/1001
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-31 12:26:54 +02:00
Karel Zak ae63d7e832 fstrim: do not use Protect setting in systemd service
The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode.

The fstrim ioctl operates on read-only mountpoint file descriptor, but
on some read-only filesystem the operation can fail, so since
2d22ac64e4 we check for read-only volumes and skip it.

References: Upstream: 2d22ac64e4
Addresses: https://github.com/karelzak/util-linux/issues/948
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-04 16:24:10 +01: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
Karel Zak c64d452b3e fstrim: fix systemd service protection
ProtectHome=yes makes /home inaccessible, but we need to open the
directories (mountpoints) read-only.

Addresses: https://github.com/karelzak/util-linux/issues/824
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-07-22 11:10:30 +02:00
Sami Kerola 374baa6f64
fstrim: add --quiet option to suppress error messages
When fstrim interacts with NTFS it result can be error reporting bad file
descriptor.  That seems to be a bug in NTFS.  While waiting driver to get on
top of the issue and be commonly available lets add to fstrim option to make
it be more silent about errno 9 aka EBADF, Bad file descriptor.

Reported-by: https://github.com/moviuro
Proposed-by: Dave Reisner <dreisner@archlinux.org>
Reference: https://bugs.archlinux.org/task/62288
Addresses: https://github.com/karelzak/util-linux/issues/789
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-05-07 20:18:08 +01:00
Andreas Henriksson 8f3d2d76aa fstrim: Add hardening settings to fstrim.service
This limits what the fstrim process has access to when it runs.

PrivateUsers can't be enabled because of:
"If this mode is enabled, all unit processes are run without privileges
in the host user namespace[...]"

Further improving this with additional option or making
things even tighter is most likely possible.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-22 11:13:58 +01:00
Andreas Henriksson 0f7a57f58b fstrim: Add Documentation key to fstrim.service 2018-11-21 10:47:40 +01:00
Sami Kerola 7004da3d73 fstrim: use long options in systemd service file
Long options are more user friendly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-11-21 10:47:14 +01:00
Karel Zak 0d73ea8bf9 fstrim: update .service to follow /etc/fstab
Replace -a with -A to discard mounted filesystems from /etc/fstab. The
original -a forces fstrim to try to discard all filesystems, including
for example manually mounted removable media.

It seems better for widely used .service unit to follow /etc/fstab.

Addresses: https://github.com/karelzak/util-linux/issues/673
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-08 11:35:58 +02:00
Karel Zak 6a9aaf5491 fstrim: add -v to the systemd service
It seems to be good idea to have more verbose output in the log files
for weekly fstrim execution. The verbose adds details (one line) for
each filesystem.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1337304
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-18 12:09:53 +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