udisks icon indicating copy to clipboard operation
udisks copied to clipboard

RFE: SATA device statistics log

Open yrro opened this issue 2 months ago • 1 comments

The SATA device statistics log has a number of pages of useful information. I believe the meaning of these statistics are standardized, so you don't need any external knowledge to be able to interpret them, as opposed to the SMART attributes.

The Device Statistics is a new log that started in the ACS-3 (ATA command set 3) standard that was created to replace the common SMART attributes with standardized statistics that report the same way, in the same place, with the same meaning various counters that drive vendors have had in SMART attributes. Looking through old committee docs there is a lot of evidence of collecting a list of what is common and what is not between vendors in order to create a common collection of data that every vendor can support in exactly the same way.

- Replacing SMART attributes with standardized statistics

It would be great to be able to read these statistics via udisks.

Here's what smartctl -l devstat device gives me for a hard drive:

Device Statistics (GP Log 0x04)
Page  Offset Size        Value Flags Description
0x01  =====  =               =  ===  == General Statistics (rev 3) ==
0x01  0x008  4               3  ---  Lifetime Power-On Resets
0x01  0x010  4            4728  ---  Power-on Hours
0x01  0x018  6     14494564444  ---  Logical Sectors Written
0x01  0x020  6        38555824  ---  Number of Write Commands
0x01  0x028  6    105980284372  ---  Logical Sectors Read
0x01  0x030  6       140673015  ---  Number of Read Commands
0x01  0x038  6     17021775550  ---  Date and Time TimeStamp
0x01  0x040  4               0  ---  Pending Error Count
0x03  =====  =               =  ===  == Rotating Media Statistics (rev 1) ==
0x03  0x008  4            4533  ---  Spindle Motor Power-on Hours
0x03  0x010  4            4533  ---  Head Flying Hours
0x03  0x018  4           20004  ---  Head Load Events
0x03  0x020  4               0  ---  Number of Reallocated Logical Sectors
0x03  0x028  4               0  ---  Read Recovery Attempts
0x03  0x030  4               0  ---  Number of Mechanical Start Failures
0x03  0x038  4               0  ---  Number of Realloc. Candidate Logical Sectors
0x04  =====  =               =  ===  == General Errors Statistics (rev 1) ==
0x04  0x008  4               0  ---  Number of Reported Uncorrectable Errors
0x04  0x010  4               0  ---  Resets Between Cmd Acceptance and Completion
0x05  =====  =               =  ===  == Temperature Statistics (rev 1) ==
0x05  0x008  1              32  ---  Current Temperature
0x05  0x010  1              33  N--  Average Short Term Temperature
0x05  0x018  1              33  N--  Average Long Term Temperature
0x05  0x020  1              44  ---  Highest Temperature
0x05  0x028  1              21  ---  Lowest Temperature
0x05  0x030  1              43  N--  Highest Average Short Term Temperature
0x05  0x038  1              25  N--  Lowest Average Short Term Temperature
0x05  0x040  1              36  N--  Highest Average Long Term Temperature
0x05  0x048  1              25  N--  Lowest Average Long Term Temperature
0x05  0x050  4               0  ---  Time in Over-Temperature
0x05  0x058  1              60  ---  Specified Maximum Operating Temperature
0x05  0x060  4               0  ---  Time in Under-Temperature
0x05  0x068  1               0  ---  Specified Minimum Operating Temperature
0x06  =====  =               =  ===  == Transport Statistics (rev 1) ==
0x06  0x008  4             323  ---  Number of Hardware Resets
0x06  0x010  4               0  ---  Number of ASR Events
0x06  0x018  4               0  ---  Number of Interface CRC Errors
0xff  =====  =               =  ===  == Vendor Specific Statistics (rev 1) ==
0xff  0x040  7               0  ---  Vendor Specific
0xff  0x048  7               0  ---  Vendor Specific
0xff  0x050  7               0  ---  Vendor Specific
0xff  0x058  7               0  ---  Vendor Specific
0xff  0x060  7               0  ---  Vendor Specific
0xff  0x068  7               0  ---  Vendor Specific
0xff  0x070  7               0  ---  Vendor Specific
0xff  0x078  7               0  ---  Vendor Specific
0xff  0x080  7              70  ---  Vendor Specific
                                |||_ C monitored condition met
                                ||__ D supports DSN
                                |___ N normalized value

... and an SSD:

Device Statistics (GP Log 0x04)
Page  Offset Size        Value Flags Description
0x01  =====  =               =  ===  == General Statistics (rev 1) ==
0x01  0x008  4              58  ---  Lifetime Power-On Resets
0x01  0x010  4            5666  ---  Power-on Hours
0x01  0x018  6       884753246  ---  Logical Sectors Written
0x01  0x020  6        14471896  ---  Number of Write Commands
0x01  0x028  6      3146094933  ---  Logical Sectors Read
0x01  0x030  6        13215867  ---  Number of Read Commands
0x01  0x038  6      3221071376  ---  Date and Time TimeStamp
0x04  =====  =               =  ===  == General Errors Statistics (rev 1) ==
0x04  0x008  4               0  ---  Number of Reported Uncorrectable Errors
0x04  0x010  4               3  ---  Resets Between Cmd Acceptance and Completion
0x05  =====  =               =  ===  == Temperature Statistics (rev 1) ==
0x05  0x008  1              21  ---  Current Temperature
0x05  0x010  1              22  ---  Average Short Term Temperature
0x05  0x018  1              22  ---  Average Long Term Temperature
0x05  0x020  1              41  ---  Highest Temperature
0x05  0x028  1              18  ---  Lowest Temperature
0x05  0x030  1              32  ---  Highest Average Short Term Temperature
0x05  0x038  1               0  ---  Lowest Average Short Term Temperature
0x05  0x040  1              32  ---  Highest Average Long Term Temperature
0x05  0x048  1               0  ---  Lowest Average Long Term Temperature
0x05  0x050  4               0  ---  Time in Over-Temperature
0x05  0x058  1              70  ---  Specified Maximum Operating Temperature
0x05  0x060  4               0  ---  Time in Under-Temperature
0x05  0x068  1               0  ---  Specified Minimum Operating Temperature
0x06  =====  =               =  ===  == Transport Statistics (rev 1) ==
0x06  0x008  4             789  ---  Number of Hardware Resets
0x06  0x010  4              60  ---  Number of ASR Events
0x06  0x018  4               1  ---  Number of Interface CRC Errors
0x07  =====  =               =  ===  == Solid State Device Statistics (rev 1) ==
0x07  0x008  1               0  ---  Percentage Used Endurance Indicator
                                |||_ C monitored condition met
                                ||__ D supports DSN
                                |___ N normalized value

yrro avatar Oct 23 '25 15:10 yrro

This is not an easy task as libatasmart doesn't support it. Its API would first need to be extended. There's an interesting initiative going on in https://github.com/smartmontools/smartmontools/issues/409 so once that work is done and fits our needs, we may start thinking about deprecating the current libblockdev smart plugin implementation in favour of this one, adopting new functionality. That may take years however.

tbzatek avatar Oct 23 '25 15:10 tbzatek