Opened 2 months ago

#29846 new defect

fstrim script makes noises on some servers

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

Description

we get this nightly since bungei was installed:

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

/etc/cron.daily/puppet-trim-fs:
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:

#!/bin/bash

# by weasel

if tty > /dev/null; then
  verbose="-v"
else
  verbose=""
fi

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

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

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 (0)

Note: See TracTickets for help on using tickets.