#29846 closed defect (fixed)

fstrim script makes noises on some servers

Reported by: anarcat Owned by: anarcat
Priority: Low Milestone:
Component: Internal Services/Tor Sysadmin Team Version:
Severity: Minor Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


we get this nightly since bungei was installed:

To: root@bungei.torproject.org
Date: Thu, 21 Mar 2019 06:25:03 +0000

fstrim: /srv/backups/pg: the discard operation is not supported
fstrim: /srv/backups/bacula: the discard operation is not supported

this is from the following script deployed through puppet:


# by weasel

if tty > /dev/null; then

awk '$9 ~ "^(ext4|xfs)$" && $4 == "/" {print $3, $5}' /proc/self/mountinfo | while read mm mountpoint; do
  [ -e "$path" ] || continue
  path="$(readlink -f "$path")"

  while : ; do
    if [ -e "$qi" ]; then
      [ "$(cat "$qi")" -gt "0" ] && fstrim $verbose "$mountpoint"
    # else try the parent
    path="$(readlink -f "$path/..")"
    # as long as it's a device
    [ -e "$path/dev" ] || break

I can confirm the mapped device cannot be "trimmed":

root@bungei:/home/anarcat# fstrim -v /srv/backups/pg
fstrim: /srv/backups/pg: the discard operation is not supported

I'm unsure why that is the case. I suspect it might be a matter of adding the issue_discards option to lvm.conf, but I'm not sure. I also note that the discard option is not present in crypptab either.

In the Debian wiki SSDOptimization page, they mention a fstrim systemd service (not required in Buster, apparently) that supposedly takes care of that work for us. It does, however, only the following command:

fstrim -av

... which doesn't seem to do anything here. It also doesn't silence the warnings from the script, so I'm not sure it's *doing* anything.

In any case, I welcome advice on how to deal with that one warning.

Child Tickets

Change History (3)

comment:1 Changed 14 months ago by weasel

since bungei has rotating disks, that script probably shouldn't run there anyhow. Thus, the fact that fstrim -av doesn't do anything is not surprising. (If bungei did have SSDs, the crypttab should have the discard option.)

Regardless, we probably should replace that script with using the fstrim service and its timer shipped by util-linux -- /usr/share/doc/util-linux/examples/fstrim.{service,timer}.

comment:2 Changed 13 months ago by anarcat

Owner: changed from tpa to anarcat
Status: newassigned

tired of getting that spam, taking a look

comment:3 Changed 13 months ago by anarcat

Resolution: fixed
Status: assignedclosed

somehow that noise went away on bungei, it was only left on archive-01. i fixed it there by activating the fstrim.timer that seems to be disabled by default, and only available on buster, and removed the cronjob we were deploying.

hopefully this will go away next night. the service runs weekly so worst case we'll get 6 less warnings per week. :p

Note: See TracTickets for help on using tickets.