How can I prevent smartd from reporting that it cannot find a disk?
Solution 1
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.
Solution 2
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.
Solution 3
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 [email protected] -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 <[email protected]>" $4
Related videos on Youtube
Comments
-
Sparhawk over 1 year
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 issmartctl 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
isDEVICESCAN -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?
-
mivk about 5 yearsThis problem seems to be fixed in smartmontools 6.6 (see here), but unfortunately that version is not available in the current Debian stable "Stretch".
-
-
Sparhawk about 10 years+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.
-
Ace over 9 yearssmartd is open source, im sure if you implemented such a solution then you could push it upstream
-
Sparhawk over 9 yearsYes, I know this, but I am still to find the solution that does what I want.
-
Sparhawk almost 9 yearsThis 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. -
Ramesh about 7 yearsGoing manual and removing discovery isn't exactly ideal. HUPing the daemon or restarting it matches more what OP wanted to do.
-
rtaft almost 4 years@sparhawk I'm a bit confused, that IS an answer, restart the service, and it stops the annoying daily emails, you had a popup with the same error. I reworded it so its more clear
-
Sparhawk almost 4 yearsAh sorry, I misinterpreted the answer. I'll +1 to level out the downvote!