4

After unplugging a USB disk that I kept attached for a long time, I recieved a "hard disk health warning" dialog (shown by a process called smart-notifier) and an e-mail with the subject "SMART error (FailedOpenDevice) detected on host".

How can I prevent these warnings when I remove a USB disk?

I checked the contents of /etc/smartd.conf and the only non-comment line is the following:

DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner

It seems that smartd has a concept of removable drives, but the man page only mentions how it changes behaviour when the drive is missing upon startup and it is unclear about what happens later when actually removing the drive.

One more thing to note is that the drive does not get a device name like /dev/usb* but it is registered as /dev/sdc for some reason.

2
  • when you unplugged your USB device, do you wait for the shutdown notification of the USB? Because if you unplugged it without saying at the computer you will do it (or if you wait a little), the iptable of the USB device won't be update (or corrupted), so you can lost data, damaged your USB device or, in the worst case brick the USB device
    – damadam
    Commented Jul 3, 2018 at 7:14
  • I don't remember exactly how I did it at that time, but it just happened to me again today and now I really paid attention to every step I take. I removed it using gnome-disks as follows: 1. unmounted the single luks-encrypted partition 2. closed the luks device 3. clicked the power off icon (drive led went out) 4. clicked the eject button 5. unplugged USB disk.
    – Zoltan
    Commented Aug 15, 2018 at 9:34

4 Answers 4

3

I found the following workaround: After removing the drive, restart the SMART monitoring daemon:

sudo systemctl restart smartmontools.service

This will prevent further e-mails. To silence the initial message as well, stop the deamon before removing the USB disk, then start it again:

sudo systemctl stop smartmontools.service
# Remove USB disk
sudo systemctl start smartmontools.service
1

If your removable device(s) has every time the same device file (/dev/sdc at example) you can ignore this device. To do that you must add following line before your DEVICESCAN line in /etc/smartd.conf:

/dev/sdc -d ignore

See also: https://lists.debian.org/debian-user/2021/05/msg01052.html

0

@Zoltan's restart answer will do the trick, but a more standardised way of restarting any daemon on most distros is doing it this way...

sudo service smartmontools restart

Basically the syntax is

$ sudo service <any daemon name> <start||stop||restart>

There are other ways like with systemd's systemctl... but my preference is to keep it simple and stupid like above.

-1

This is deprecated. systemd is becoming nearly universal. The syntax is:

systemctl smartmontools restart
2
  • 2
    I don't think this the correct syntax of systemctl. Did you mean systemctl restart smartmontools?
    – Kulfy
    Commented Jan 8, 2021 at 8:50
  • It is systemctl restart <service_daemon> indeed. Commented Sep 13, 2022 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .