ctuffli / smart

Application to output the SMART values of disks (mirror)
ISC License
12 stars 1 forks source link

Nonsensical temperature values on SATA drives #6

Closed afengler closed 5 years ago

afengler commented 5 years ago

Temperature values, for 194 at least, are reporting odd numbers such as 77309411349 I'm seeing this across multiple SATA drive types, on both SATA and SAS controllers. SAS drives report temperatures correctly.

Seems to get the thresholds correct though:

208 194 133145427997 34 71 69

Here's the outputs of smart -di for a few.

dbg: ATA command1 = 0x346b
dbg: protocol ATA (specified auto)
Device ST4000DM000-1F2168
Revision CC54
Serial Z307VMJC
dbg: SMART is supported
208 1 162045528
208 3 0
208 4 9
208 5 0
208 7 225615747
208 9 21982
208 10 0
208 12 9
208 183 0
208 184 0
208 187 0
208 188 0
208 189 0
208 190 722731030
208 191 0
208 192 3
208 193 375
208 194 73014444054
208 197 0
208 198 0
208 199 0
208 240 39260296074712
208 241 29757408312
208 242 48441609406
dbg: Looking for page 0x89 (total = 8):
dbg:    [0] = 0
dbg:    [1] = 0x80
dbg:    [2] = 0x83
dbg:    [3] = 0x87
dbg:    [4] = 0x89
dbg: ATA command1 = 0x346b
dbg: protocol ATA (specified auto, tunneled ATA)
Vendor ATA
Device ST4000DM000-2AE1
Revision 0001
Serial WDH130QJ
dbg: SMART is supported
208 1 160310586
208 3 0
208 4 7
208 5 0
208 7 1038310304
208 9 84490596668896
208 10 0
208 12 7
208 183 0
208 184 0
208 187 0
208 188 0
208 189 0
208 190 672333845
208 191 0
208 192 908
208 193 1246
208 194 77309411349
208 197 0
208 198 0
208 199 0
208 240 141201344845166
208 241 29778799829
208 242 9792307029
dbg: ATA command1 = 0x746b
dbg: protocol ATA (specified auto)
Device KINGSTON SA400S37480G
Revision SBFK61K1
Serial 50026B778238D0EA
dbg: SMART is supported
208 1 0
208 9 2035
208 12 126
208 148 0
208 149 0
208 167 0
208 168 0
208 169 18
208 170 41
208 172 0
208 173 1114173
208 181 0
208 182 0
208 187 0
208 192 9
208 194 133145427997
208 196 0
208 199 0
208 218 0
208 231 98
208 233 6689
208 241 3645
208 242 785
208 244 17
208 245 61
208 246 737888
208 246 737888
ctuffli commented 5 years ago

I have this recollection that the temperature is encoded, and looking at the value in hexadecimal helps. For the last example above, what does smartctl report? 133145427997 in hex is 0x1F0016001D. So my bet is smartctl reports the temperature as 29 or 31C (I forget which byte is 0).

afengler commented 5 years ago

Yep, 29C So the last of the "segments" is the temperature in hex? So [max]00[min]00[current] if I'm decoding this correctly.

smart -x -a 194 ada0
0x1f0016001d
smartctl -a /dev/ada0 | grep 194
194 Temperature_Celsius     0x0022   071   069   000    Old_age   Always       -       29 (Min/Max 22/31)
ctuffli commented 5 years ago

Exactly. With bash you could do something like echo $((133145427997%256))

afengler commented 5 years ago

Thanks, I figured out how to do it in awk to make atasmart sensible I made PR #7 with the changes to the awking