Page 1 of 1

HDD S.M.A.R.T

Posted: Tue Jun 24, 2014 2:47 pm
by Mario_r4
Задумался над реализацией сабжа, но информации по собственно низкоуровневому доступу шиш да маленько. Нашел статью на хабре, по похоже там уже тоже со встроенными средствами Шиндовс работа идет. Из остального только описание. Если у кого есть информация по непосредственному (низкоуровневому) программированию поделитесь пожалуйста.

Re: HDD S.M.A.R.T

Posted: Tue Jun 24, 2014 3:09 pm
by SoUrcerer

Re: HDD S.M.A.R.T

Posted: Tue Jun 24, 2014 5:59 pm
by buyerninety
Interesting discussion giving some interesting background information and
some opinions regarding the S.M.A.R.T feature;
http://www.dslreports.com/forum/r288672 ... ID-234-is-

Re: HDD S.M.A.R.T

Posted: Wed Jun 25, 2014 6:28 am
by Mario_r4
buyerninety
Thank you! Your link will probably be useful.

Probably here this part of the text - this is what I need:
Spoiler:If you want to reverse-engineer this, you can use smartctl -H -r ataioctl,2 /dev/sda to dump the full payload data. The ATA command for SMART attribute retrieval is 0xb0 ("SMART READ DATA" / "SMART READ ATTRIBUTE VALUES"), feature request 0xd0. The hexadecimal data you get back are all the attributes and their values. For the format of most (but not all) of the data, you will need to read the smartmontools source code. Taken from my own code comments:

Code: Select all

+/*
+ * Obtain SMART attributes and their values
+ *
+ * Feature 0xd0 result (see ATA8-ACS, section 7.53.6.2, table 49):
+ *
+ * The 512-byte result of SMART READ DATA is documented per ATA8-ACS
+ * specification, section 7.53.6.2, table 49.  However, you'll find
+ * bytes 0-361 marked "Vendor specific"; these are (mostly) the
+ * actual SMART attributes themselves.  Example:
+ *
+ * Offset   Size (B)  Description
+ * -------- --------- ---------------------------------------------------
+ * 0        2         SMART attribute revision (16-bit, big endian)
+ * 2        12        SMART attribute data entry #0
+ * 14       12        SMART attribute data entry #1
+ * .....
+ * 348      12        SMART attribute data entry #29
+ * .....              <see ATA8-ACS specification from here onwards>
+ * -------- --------- ---------------------------------------------------
+ *
+ * The SMART attribute data format is completely undocumented.  It
+ * consists of 12 bytes per attribute in the following format:
+ *
+ * Offset   Size (B)  Description
+ * -------- --------- ---------------------------------------------------
+ * 0        1         Attribute ID number
+ * 1        2         Attribute flags
+ * 3        1         Attribute CURRENT value (adjusted)
+ * 4        1         Attribute WORST value (adjusted)
+ * 5        6         Attribute data
+ * 11       1         <reserved - 0x00>
+ * -------- --------- ---------------------------------------------------
+ */

Re: HDD S.M.A.R.T

Posted: Wed Jun 25, 2014 7:06 am
by SoUrcerer
Ого, похоже, всё просто.

Re: HDD S.M.A.R.T

Posted: Wed Jun 25, 2014 8:57 am
by Mario_r4
SoUrcerer wrote:Ого, похоже, всё просто.
Ага, также как просто скомпилировать NetSurf для Колибри - вроде все очевидно, но есть нюансы.