[tor-bugs] #29846 [Internal Services/Tor Sysadmin Team]: fstrim script makes noises on some servers

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Mar 21 13:57:06 UTC 2019


#29846: fstrim script makes noises on some servers
-----------------------------------------------------+-----------------
     Reporter:  anarcat                              |      Owner:  tpa
         Type:  defect                               |     Status:  new
     Priority:  Low                                  |  Milestone:
    Component:  Internal Services/Tor Sysadmin Team  |    Version:
     Severity:  Minor                                |   Keywords:
Actual Points:                                       |  Parent ID:
       Points:                                       |   Reviewer:
      Sponsor:                                       |
-----------------------------------------------------+-----------------
 we get this nightly since bungei was installed:

 {{{
 To: root at 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 at 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 [https://wiki.debian.org/SSDOptimization 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.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/29846>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list