Bug 429331

Summary: smart properties and test results should be visible and notify the user
Product: [Plasma] plasma-disks Reporter: Luiz Angelo De Luca <luizluca>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: katyaberezyaka, sitter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: smart.json

Description Luiz Angelo De Luca 2020-11-19 02:44:30 UTC
SUMMARY

I have a failing disk and give plasma-disks a try. However, according to plasma-disks, my device was as good as a new HDD. The "SMART overall-health self-assessment test result" should not be blindly trusted.

I'll paste my smartctl output showing many warning problems like:

1) failed tests. They might not be a final sentence but the user should be notified
2) repeated failed tests on the same sector: This indicates a even worse scenario than 1)
3) Reported_Uncorrect increasing
4) Multiple repeating UNC

# smartctl -a /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.9.1-2-default] (SUSE RPM)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.14 (AF)
Device Model:     ST3000DM001-1ER166
Serial Number:    Z501MAQ5
LU WWN Device Id: 5 000c50 07bd700c6
Firmware Version: CC26
User Capacity:    3.000.592.982.016 bytes [3,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Nov 18 23:21:10 2020 -03
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

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:                (   89) seconds.
Offline data collection
capabilities:                    (0x73) 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.
                                        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:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 321) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x1085) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   119   099   006    Pre-fail  Always       -       220595456
  3 Spin_Up_Time            0x0003   095   094   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       471
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       8
  7 Seek_Error_Rate         0x000f   070   047   030    Pre-fail  Always       -       387418648400
  9 Power_On_Hours          0x0032   069   069   000    Old_age   Always       -       27196
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       402
183 Runtime_Bad_Block       0x0032   099   099   000    Old_age   Always       -       1
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   011   011   000    Old_age   Always       -       89
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       0 0 5
189 High_Fly_Writes         0x003a   082   082   000    Old_age   Always       -       18
190 Airflow_Temperature_Cel 0x0022   059   052   045    Old_age   Always       -       41 (Min/Max 33/48)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       3
193 Load_Cycle_Count        0x0032   065   065   000    Old_age   Always       -       71480
194 Temperature_Celsius     0x0022   041   048   000    Old_age   Always       -       41 (0 19 0 0 0)
197 Current_Pending_Sector  0x0012   090   090   000    Old_age   Always       -       1640
198 Offline_Uncorrectable   0x0010   090   090   000    Old_age   Offline      -       1640
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       23694h+22m+44.043s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       79812508249
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       11747615309677

SMART Error Log Version: 1
ATA Error Count: 89 (device log contains only the most recent five errors)
        CR = Command Register [HEX]
        FR = Features Register [HEX]
        SC = Sector Count Register [HEX]
        SN = Sector Number Register [HEX]
        CL = Cylinder Low Register [HEX]
        CH = Cylinder High Register [HEX]
        DH = Device/Head Register [HEX]
        DC = Device Command Register [HEX]
        ER = Error register [HEX]
        ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 89 occurred at disk power-on lifetime: 27191 hours (1132 days + 23 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 53 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      04:14:56.788  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:56.788  READ FPDMA QUEUED
  ef 10 02 00 00 00 a0 00      04:14:56.782  SET FEATURES [Enable SATA feature]
  27 00 00 00 00 00 e0 00      04:14:56.782  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      04:14:56.782  IDENTIFY DEVICE

Error 88 occurred at disk power-on lifetime: 27191 hours (1132 days + 23 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 53 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      04:14:53.051  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:53.051  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:53.051  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:53.051  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:53.037  READ FPDMA QUEUED

Error 87 occurred at disk power-on lifetime: 27191 hours (1132 days + 23 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 53 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      04:14:49.285  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:49.285  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:49.285  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:49.285  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:49.265  READ FPDMA QUEUED

Error 86 occurred at disk power-on lifetime: 27191 hours (1132 days + 23 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 53 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      04:14:45.545  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:45.544  READ FPDMA QUEUED
  ef 10 02 00 00 00 a0 00      04:14:45.539  SET FEATURES [Enable SATA feature]
  27 00 00 00 00 00 e0 00      04:14:45.539  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      04:14:45.538  IDENTIFY DEVICE

Error 85 occurred at disk power-on lifetime: 27191 hours (1132 days + 23 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 53 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      04:14:42.058  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:42.058  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:41.380  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:41.380  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      04:14:41.380  READ FPDMA QUEUED

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed: read failure       90%     27184         4097844144
# 2  Extended offline    Completed: read failure       90%     27182         4097844144
# 3  Extended offline    Completed: read failure       90%     27182         4097844144
# 4  Short offline       Completed: read failure       90%     27176         4097844144
# 5  Short offline       Completed: read failure       90%     27153         4097844144
# 6  Short offline       Completed without error       00%     27129         -
# 7  Short offline       Completed without error       00%     27105         -
# 8  Short offline       Completed without error       00%     27081         -
# 9  Short offline       Completed without error       00%     27062         -
#10  Short offline       Completed without error       00%     27038         -
#11  Short offline       Completed without error       00%     27014         -
#12  Short offline       Completed without error       00%     26990         -
#13  Short offline       Completed without error       00%     26966         -
#14  Short offline       Completed without error       00%     26942         -
#15  Short offline       Completed without error       00%     26918         -
#16  Short offline       Completed without error       00%     26894         -
#17  Short offline       Completed without error       00%     26870         -
#18  Short offline       Completed without error       00%     26846         -
#19  Short offline       Completed without error       00%     26822         -
#20  Short offline       Completed without error       00%     26798         -
#21  Short offline       Completed without error       00%     26774         -

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
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.
Comment 1 Harald Sitter 2020-11-19 09:17:33 UTC
I'm really not sure how much we'd want to add heuristics on our side. In the end if the status is ok but the disk is not, that is surely a firmware problem.
Adding advanced guessing heuristics in plasma means the CLI doesn't benefit from them, which seems distinctly disadvantageous. Can you talk to the smartmontools devs about their thoughts on smartctl's behavior? https://www.smartmontools.org/wiki/WikiStart#BugReports

In any event please attach the output of `sudo smartctl --all --json /dev/sdb` it's useful test data either way.
Comment 2 Luiz Angelo De Luca 2020-11-19 13:25:28 UTC
Created attachment 133453 [details]
smart.json

I wouldn't say it's a firmware problem as some of those errors might be transient. However, the same way smartd reported to logs as errors (in red), kde should notify the user:

Device: /dev/sdb [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 58 to 59
Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 42 to 41
Device: /dev/sdc [SAT], SMART Prefailure Attribute: 1 Raw_Read_Error_Rate changed from 117 to 120
Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 41 to 40
Device: /dev/sdb [SAT], 1640 Currently unreadable (pending) sectors
Device: /dev/sdb [SAT], 1640 Offline uncorrectable sectors

These last two are in red.
Comment 3 Harald Sitter 2020-11-19 14:23:58 UTC
Thanks for the json.

KDE is a community. I'm sure we'll not report anything ;)
Plasma will, but unfortunately the userbase of Plasma is muuuuch too varied to report that kind of data.

The problem with reporting the lines you mention is that 99% of people won't know what they mean or what to do about them which is why we break the entire affair down to a binary state of either everything is grand or everything is not. Which has the disadvantage that potentially failing disks slip under the radar if the overall status says ok even when it isn't.

At the same time replicating what smartd already does and tracking report trends to discern problems seems a bit useless given, well, smartd already does just that ^^

We could maybe have a tiny hint icon somewhere in kinfocenter that there were problems in the report data so the user can look at it and/or choose to err on the side of caution and replace the disk.
Comment 4 Luiz Angelo De Luca 2020-11-19 17:06:38 UTC
(In reply to Harald Sitter from comment #3)
> KDE is a community. I'm sure we'll not report anything ;)
> Plasma will, but unfortunately the userbase of Plasma is muuuuch too varied
> to report that kind of data.

I'm still from the times where kde was a thing, not a community... Old habits die hard. 

 
> The problem with reporting the lines you mention is that 99% of people won't
> know what they mean or what to do about them which is why we break the
> entire affair down to a binary state of either everything is grand or
> everything is not. Which has the disadvantage that potentially failing disks
> slip under the radar if the overall status says ok even when it isn't.

HDD dying process is a little more subtle than "run, I'm gonna explode!". A read error with a msg like "it might be a one time error like a power outage. However, if this error keeps reoccurring, it indicates that part of your data in your HDD is not readable anymore". This is something a user might understand. It could show previous tests or error messages to let the user decide if a new HDD is needed.

> At the same time replicating what smartd already does and tracking report
> trends to discern problems seems a bit useless given, well, smartd already
> does just that ^^

It generates the error log. However, that error will never reach a gui-only user. That's what I'm suggesting: exposing "Hey, a read error happened!" to gui users. If smarttools guys does not have a good heuristic, it is not plasma-disk that will implement one. But plasma-disk could expose and "translate" some errors and let the user decide.

> We could maybe have a tiny hint icon somewhere in kinfocenter that there
> were problems in the report data so the user can look at it and/or choose to
> err on the side of caution and replace the disk.

If all last self-tests finished with an error, it should be something to report with a big red flashing icon. Not something subtle inside kinfocenter.
Comment 5 Harald Sitter 2020-11-20 14:38:06 UTC
You can have smartd send notifications
Comment 6 Harald Sitter 2020-11-20 14:45:39 UTC
Whoops. Hit save too soon. You could have smartd send notifications to journal and then pick them out via trivial scripting. I really don't think the KCM has a role to play here though. As far as we are concerned there is no nuance. Thats a choice of maintainability of the code as much as the user experience. Either the firmware reports status OK or not. If it is not OK we advise the disk be replaced. If the firmware reports OK but it's not OK then that's a firmware problem same as when the firmware reports not OK but the disk is actually ok. At the same time lower level metrics tracking is something smartd has covered well enough already that I don't see the particular use in replacing that. In particular not as a standard plasma feature.
Comment 7 Luiz Angelo De Luca 2020-11-20 17:46:38 UTC
(In reply to Harald Sitter from comment #6)
> Whoops. Hit save too soon. You could have smartd send notifications to
> journal and then pick them out via trivial scripting.

If the user can script that, plasma-disk is just an additional feature. I was thinking about those users that does not know how to do that (and does not even know S.M.A.R.T. exists. If plasma has a tool that reads smart data, it would not make sense to have a new tool to do just the same, but better. 

A repeated error at the same position would tell the user that if there is info info stored there, it is gone as CRC is not matching. Is it a HW failure? Maybe not. It could be generated by a power outage, and external interference scrambling bits, firmware bug... who knows? As an advanced user, I would look for badblocks, fsck the filesystem or ever recreate the FS. It would be nice if the read error message could identify the affected filepath, offer to run check tools (fsck, badblocks, ....), suggest a backup... plasma-disks is a nice feature for a cli user but it will be the only monitor tool for non-cli plasma users.

In my case, I zero-filled the disk and now it is working as usual. However, I don't trust that HDD anymore to store anything important. My filesystem got irrecoverably corrupted and I did a backup and recreated the FS.
Comment 8 Harald Sitter 2021-02-01 15:19:25 UTC
Merging with a similar report.

The arguments here only align with a single one of our design personas. Partitionmanager might have interest in growing more in-depth analytic capabilities, but for core Plasma this is way too far out there to justify the cost of maintaining the code, let alone writing it. There are entire continents of work between what the software currently does and what you'd like it to do.
It also doesn't really fit the design philosophy here. We actually want the information to be awkwardly high level because we want everyone to have a sense of what to do next without making their eyes glaze over, and then potentially steer them towards more specialized software to take next steps. e.g. backup data with kup, inspect the disk in detail in partitionmanager

I appreciate that there is a market for further monitoring and diagnostic capabilities, just not in plasma-disks, not right now anyway.

That being said, the fact that we ignore indication of problems needs to be dealt with, that's what the other bug is about. The actual analytics component of what is wrong I'd rather see outsourced to another piece of software.

*** This bug has been marked as a duplicate of bug 429804 ***