7

I have smartd monitoring my hard drives. It works fine generally, but the following error window has been consistently popping up every 24 hours.

This email was generated by the smartd daemon running on:
  host name: sparhawk-XPS-17
  DNS domain: [Unknown]
  NIS domain: (none)
The following warning/error was logged by the smartd daemon:
Device: /dev/sdc [SAT], unable to open device
For details see host's SYSLOG.
You can also use the smartctl utility for further investigation.
Another email message will be sent in 24 hours if the problem persists.

There is no sdc connected, but nevertheless I try sudo smartctl -a /dev/sdc. The result is

smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0-26-generic] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
Smartctl open device: /dev/sdc failed: No such device

The only non–commented-out line in /etc/smartd.conf is

DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner

Is there a way to make smartd correctly identify the removal of this disk, and not complain about it? If this is not possible, then is there a way to make smartd only monitor sda and sdb?

  • 1
    This problem seems to be fixed in smartmontools 6.6 (see here), but unfortunately that version is not available in the current Debian stable "Stretch". – mivk Feb 21 '19 at 18:26
5

I've been experiencing the same issue, so I did some research. I found this:

/etc/smartd.conf

# smartd will re-read the configuration file if it receives a HUP
# signal

# The file gives a list of devices to monitor using smartd, with one
# device per line. Text after a hash (#) is ignored, and you may use
# spaces and tabs for white space. You may use '\' to continue lines.

# You can usually identify which hard disks are on your system by
# looking in /proc/ide and in /proc/scsi.

# The word DEVICESCAN will cause any remaining lines in this
# configuration file to be ignored: it tells smartd to scan for all
# ATA and SCSI devices.  DEVICESCAN may be followed by any of the
# Directives listed below, which will be applied to all devices that
# are found.  Most users should comment out DEVICESCAN and explicitly
# list the devices that they wish to monitor.

I assume that unregistering the drive from the kernel via

root@localhost# echo 1 > /sys/block/sdX/device/delete

then removing the device entry from /etc/smartd.conf,

then doing "sudo service smartmontools restart" will fix your issue and smartd will stop reporting the missing drive.

|improve this answer|||||
  • +1, but I'd prefer a generic solution to only ignore removal of disks in general. Preferably, it'd work automatically for all disks, and also still scan disks for other problems. – Sparhawk Mar 3 '14 at 5:47
  • smartd is open source, im sure if you implemented such a solution then you could push it upstream – Ace Sep 5 '14 at 17:09
  • Yes, I know this, but I am still to find the solution that does what I want. – Sparhawk Sep 6 '14 at 0:24
3

You can cause smartd to only monitor a specific set of devices by listing those devices explicitly in /etc/smartd.conf, instead of using the DEVICESCAN keyword.

So, in order to only monitor /dev/sda and /dev/sdb, you would remove from your smartd.conf:

DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner

And instead of it, add:

/dev/sda -m root -M exec /usr/share/smartmontools/smartd-runner
/dev/sdb -m root -M exec /usr/share/smartmontools/smartd-runner

Then restart the smartd daemon.

The major downside of this approach is that you need to list each disk individually in the configuration. At least with only two disks, that's not too much of a hassle.

|improve this answer|||||
  • 2
    This works well for preventing scanning of /dev/sdc. However, do you know if smartd will normally scan newly-connected USB drives? Ideally, it would still scan /dev/sdc, but not report when it's disconnected. – Sparhawk Jul 6 '15 at 23:47
  • 2
    Going manual and removing discovery isn't exactly ideal. HUPing the daemon or restarting it matches more what OP wanted to do. – Benoit Duffez Mar 17 '17 at 16:00
1

In my case after replace failed HDD help just remove csv and restart service:

sudo systemctl stop smartmontools
sudo killall smartd
cd /var/lib/smartmontools
sudo rm attrlog.WDC_WD5000LPLX_00ZNTT0-WD_SERIAL_NUMBER.ata.csv
sudo rm smartd.WDC_WD5000LPLX_00ZNTT0-WD_SERIAL_NUMBER.ata.state
sudo rm smartd.WDC_WD5000LPLX_00ZNTT0-WD_SERIAL_NUMBER.ata.state~
sudo systemctl start smartmontools

My smartd.conf

DEVICESCAN -H -l error -l selftest -f -s (O/../.././14|L/../.././15|C/../.././17) -m admin@example.com -M exec /usr/share/smartmontools/smartd-runner

My /etc/smartmontools/run.d/10s-nail

#!/bin/bash -e

# Send mail if /usr/bin/s-nail exists
if ! [ -x /usr/bin/s-nail ]; then
  echo "Your system does not have /usr/bin/s-nail. Install the s-nail package" 
  exit 1
fi

# $1 - body file
# $2 - "-s"
# $3 - subject
# $4 - admin email

/usr/bin/s-nail -q $1 -s "$3" -S smtp=smtp://192.168.1.11 -S from="SERVER_NAME S.M.A.R.Td <servername@example.com>" $4
|improve this answer|||||
0

Maybe it's solved adding -d removable to DEVICESCAN, like this:

DEVICESCAN -d removable -m root -M exec /usr/share/smartmontools/smartd-runner
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.