[smartmontools-support] using smartd to monitor a rotating group of USB drives? -- "smartd -q onecheck"

Nathan Stratton Treadway nathanst at ontko.com
Wed Nov 21 01:39:24 CET 2018

On Sun, Nov 04, 2018 at 19:51:32 +0100, Christian Franke wrote:
> Nathan Stratton Treadway wrote:
> >Will it cause any problems/conflicts to run "smartd -q onecheck" at the
> >same time as the standard long-term smartd process is running (assuming
> >that I make sure the internal drives are excluded from monitoring by the
> >smartd_for_usb_drives.conf file)?
> This should be safe.

Just to wrap up this aspected of the discussion: 

I set up a "smartd-external_drives.conf" file which excludes/ignores
the four internal drives and then has a DEVICESCAN line to catch all the

# specifically exclude any drive that's mentioned in smartd.conf (those
# will be monitoring constantly by the standard system instance of
# smartd), then use DEVICESCAN to detect any other devices which happen
# to be plugged in when this instance of smartd is executed.
  /dev/sda -d ignore
  /dev/sdb -d ignore
  /dev/sdc -d ignore
  /dev/sdd -d ignore
DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner -a -s (S/../.././12)

And then set up a cron job which runs the following command at suitable
times of the day:

  smartd -q onecheck -c /etc/smartd-external_drives.conf

This has been working very well: any external drives currently plugged
in at that moment are checked a few times a day, with the state and
attrlog information always recorded in the correct file for that
particular drive... and the short self-test is automatically kicked off
once a day (or the first time a drive is checked when it re-appears
after being unplugged and taken off-site).

The one slightly inconvient thing with this approach I didn't anticipate
is that "-q onecheck" turns on debug mode and thus output is sent to
stdout rather than SYSLOG; in our particualr use-case case, it means I
have to be redirect the output to some special-purpose file in my cron
job, and also that the smartd log entries for the external drives don't
show up in the system logs along with the entries for the internal
drives (i.e. forwarded to our site-wide log server).

But overall it seems to accomplish the goal of having some level of
automated warning if these external drives start to have any of the
sorts of problems that smartd can detect.


Nathan Stratton Treadway  -  nathanst at ontko.com  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239

More information about the Smartmontools-support mailing list