Opened 15 years ago

Closed 15 years ago

#20 closed enhancement (fixed)

weird byte order of "Head Flying Hours"

Reported by: stlman Owned by: Christian Franke
Priority: minor Milestone: Release 5.40
Component: all Version: 5.38
Keywords: Cc:

Description

I've bought a brand new 1T Seagate drive yesterday.

kotik tmp # dmesg | grep ST31
[    0.834822] ata1.00: ATA-8: ST31000528AS, CC35, max UDMA/133
[    0.847168] scsi 0:0:0:0: Direct-Access     ATA      ST31000528AS     CC35 PQ: 0 ANSI: 5

I was quite surprised to see its Head_Flying_Hours to be some n-teen digit number when I first run smartctl on it, however, Power_On_Hours value was sane. To be sure that everything is ok with my eyes I ran smrtctl again. This time the value was completely different although of the same order of magnitude. After quick investigation it became quite obvious that there is something wrong with the byte order of the raw value

kotik tmp # smartctl -d ata  -A  /dev/sda  | grep ^240
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       102838696935451
kotik tmp # printf "%x\n" 102838696935451
5d880000001b

When I read the values with my programme (see attachment) I found that one of the bytes of the value is stored in the reserv field of the ata_smart_attribute structure. The right order to read the value seems to be

raw[3], raw[2], raw[1], raw[0], reserv, raw[5], raw[4]

However, I am not sure about more significant bytes (raw[1-3]).

The value itself is almost for sure number of milliseconds.

Attachments (1)

hfh.cpp (1.7 KB ) - added by stlman 15 years ago.
Decode Head_Flying_Hours from ST31000528AS Seagate drive

Download all attachments as: .zip

Change History (4)

by stlman, 15 years ago

Attachment: hfh.cpp added

Decode Head_Flying_Hours from ST31000528AS Seagate drive

comment:1 by Christian Franke, 15 years ago

Version: 5.38

comment:2 by Christian Franke, 15 years ago

Milestone: Release 5.40
Owner: changed from somebody to Christian Franke
Priority: majorminor
Status: newaccepted
Type: defectenhancement

comment:3 by Christian Franke, 15 years ago

Resolution: fixed
Status: acceptedclosed

r3001.

It is now possible to specify the byte order by '-v' option. The following should work for this drive:

smartctl -v 240,raw48:3210r54 ...'

The -v option can be put in a drive database entry which can also be read from a file (/etc/smart_drivedb.h).

Note: See TracTickets for help on using tickets.