2

I enabled SMART notifications on my laptop running Debian. Basically I just want to get a notification pop up when something goes wrong on a disk. I don't want to get an email, I think a notification is better indicated on the workstation where I spend my days (while emails are off course better for servers).

It works, I even tested it (but what exactly did I test ?), but I still have doubts if I did it the right way, and if what I did is really useful.

Basically, what I did :

  1. I installed smartmontools and smart-notifier
# apt-get install smartmontools smart-notifier
  1. I then configured the smartd daemon to monitor /dev/sda and send its messages to the notifier. This is done in /etc/smartd.conf, in which I have only 1 line :
/dev/sda -a -m myUsername -M exec /usr/share/smartmontools/smartd-runner -M test
  1. The -M test option in the previous command displays a test notification popup as soon as I restart the smartd daemon (you have to log out and log back in in order for it to work). And it works, restarting the smartd daemon displays the test notification popup.
  2. And finally I removed the -M test option and restarted smartd again.

So, can I be at ease now ? Will this setup send me a popup as soon as something goes wrong with /dev/sda ? I have a lot of unanswered questions :

  1. With the -M test option, the test notification popup is only displayed when I restart smartd. Nothing is displayed when I restart my laptop and log in (probably because smartd is already running at that point). Can I be confident that a notification will pop up if smartd detects something wrong on my disks ?
  2. What event exactly will trigger that pop up ? In other words, what is "something wrong" ? $ man smartd states that :

smartd will attempt to enable SMART monitoring on ATA devices (equivalent to smartctl -s on) and polls these and SCSI devices every 30 minutes (configurable), logging SMART errors and changes of SMART Attributes via the SYSLOG interface.

And indeed, checking /var/log/syslog I can see a log entry after 30 minutes (last line) :

Jul 30 13:17:06 precision7520 smartd[20258]: smartd 6.6 2016-05-31 r4324 [x86_64-linux-4.19.0-0.bpo.5-amd64] (local build)
Jul 30 13:17:06 precision7520 smartd[20258]: Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
Jul 30 13:17:06 precision7520 smartd[20258]: Opened configuration file /etc/smartd.conf
Jul 30 13:17:06 precision7520 smartd[20258]: Configuration file /etc/smartd.conf parsed.
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda, type changed from 'scsi' to 'sat'
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], opened
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], Samsung SSD 850 EVO 2TB, S/N:S2RMNB0J801642K, WWN:5-002538-c407b1fd2, FW:EMT02B6Q, 2.00 TB
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], not found in smartd database.
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], can't monitor Current_Pending_Sector count - no Attribute 197
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], can't monitor Offline_Uncorrectable count - no Attribute 198
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], is SMART capable. Adding to "monitor" list.
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], state read from /var/lib/smartmontools/smartd.Samsung_SSD_850_EVO_2TB-S2RMNB0J801642K.ata.state
Jul 30 13:17:06 precision7520 smartd[20258]: Monitoring 1 ATA/SATA, 0 SCSI/SAS and 0 NVMe devices
Jul 30 13:17:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], state written to /var/lib/smartmontools/smartd.Samsung_SSD_850_EVO_2TB-S2RMNB0J801642K.ata.state


Jul 30 13:47:06 precision7520 smartd[20258]: Device: /dev/sda [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 67 to 68

But no pop up. Maybe because the log entry was just a minor information (a 1 degree temperature increase) ? But then, what kind of event exactly is supposed to trigger the notification ?

  1. Finally, there are a lot of examples in /etc/smartd.conf, with even more in $ man smartd.conf, some performing (-s) short (-s S) or extended (-s L) self tests at given intervals. Are those self tests necessary ? Isn't SMART supposed to integrate its own self test procedures (the SM of SMART stands for Self-Monitoring) ? How useful are results without performing self tests ?

For information, my # smartctl /dev/sda results :

$ sudo smartctl -a /dev/sda
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.19.0-0.bpo.5-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     Samsung SSD 850 EVO 2TB
Serial Number:    S2RMNB0J801642K
LU WWN Device Id: 5 002538 c407b1fd2
Firmware Version: EMT02B6Q
User Capacity:    2 000 398 934 016 bytes [2,00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4c
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Jul 30 14:15:22 2021 WAT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
(...)

No self test seems to be ever performed :

(...)
General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x53) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    ( 265) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.
(...)

Are these data of any use, even without self-tests ?

(...)
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   094   094   000    Old_age   Always       -       27805
 12 Power_Cycle_Count       0x0032   098   098   000    Old_age   Always       -       1055
177 Wear_Leveling_Count     0x0013   099   099   000    Pre-fail  Always       -       21
179 Used_Rsvd_Blk_Cnt_Tot   0x0013   100   100   010    Pre-fail  Always       -       0
181 Program_Fail_Cnt_Total  0x0032   100   100   010    Old_age   Always       -       0
182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0013   100   099   010    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   067   043   000    Old_age   Always       -       33
195 Hardware_ECC_Recovered  0x001a   200   200   000    Old_age   Always       -       0
199 UDMA_CRC_Error_Count    0x003e   100   100   000    Old_age   Always       -       0
235 Unknown_Attribute       0x0012   099   099   000    Old_age   Always       -       71
241 Total_LBAs_Written      0x0032   099   099   000    Old_age   Always       -       26330052507

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     14903         -
# 2  Short offline       Completed without error       00%     14709         -
# 3  Short offline       Aborted by host               70%      2733         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
  255        0    65535  Read_scanning was never started
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

A lot of question, but basically they all boil down to one : what are the best practices to enable SMART disk notifications on a Linux workstation ? I was kind of surprised that googling this question didn't provide any useful informations

1 Answer 1

2

It's not necessary to run a test; SMART gathers run-time stats.

If your device is supported (not all are), look at attribute 5 "Reallocated_Sector_Count" - occasionally - if this is not zero then it is probably worth checking more often to ensure that it doesn't show any sudden increases.

Since the existence of reallocated sectors are indicating that it your device is discovering that a few sectors are not safely writeable, causing back-up sectors to be utilised. It is probably time to consider its replacement. However, a device might run for months with a few error sectors present.

SMART is only an indicator of possible failure and in the case of SSD's, age or amount of data written might be a better indicator of impending failure.

For your model, Samsung is saying that the Wear_Leveling_Count=21. This means that you are supposed to have used 21% of the usable cells on your SSD drive and you have written the LBA count (in units of 512 bytes) to the drive.

The "Unknown_Attribute" = 71, is the number of unscheduled power-downs of your system.

12
  • 1
    It might be worth pointing out that on some drives (most HDDs IME and some SSDs), some attributes are only updated during offline tests — instead of “Always” in the “Updated” column, they are marked “Offline”. In such cases a periodic offline test is useful. Jul 31, 2021 at 7:11
  • @Jeremy Boden : "it is probably worth checking more often to ensure that it doesn't show any sudden increases.". I agree, but the whole point of what I did was to get an email to avoid to have to check it manually (or in my case a notification, which in smartmontools' terms is just an email with a specialized mailer). And my concern is : will it notify me ? I guess I just have to hope that my configuration will send a notification if for example Reallocated_Sector_Ct starts to show some numbers. I guess the only way to test it would be to plug a defect hard drive into a computer.
    – ChennyStar
    Jul 31, 2021 at 8:07
  • @Jeremy Boden :"The Unknown_Attribute = 71, is the number of unscheduled power-downs of your system." May I ask where you have this information from ?
    – ChennyStar
    Jul 31, 2021 at 8:11
  • 1
    @StephenKitt: Interesting comment ! This basically answers one of my questions : why are there examples in smartd.conf which are performing self-tests, and is it necessary ? According to your comment, the answer would be : if the Updated column shows only Always, then self-tests are not necessary. If there are some Offline rows, then self-tests would be necessary. An interesting comment, IMO it should even by an answer on its own, not just a comment.
    – ChennyStar
    Jul 31, 2021 at 8:16
  • 1
    @JeremyBoden: it may be worth noting that in terms of written LBA's, I'm at 4% of the manufacturer's warranty. I have written 26330052507 sectors of 512 bytes, so that's about 12 TiB. Manufacturer's warranty is (samsung.com/semiconductor/minisite/ssd/support/warranty) 300TBW, so 273 TiBW. 12/273 = about 4%. Which shows that in terms of warranty, the age is probably reached way before the TBW.
    – ChennyStar
    Jul 31, 2021 at 8:41

You must log in to answer this question.

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