diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 1cb6e4c260622e6f5568d5d51909e0a352c30bab..c761d668a5aa103b554bb3a3d4e3a12c8cfcb6ac 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.11 2002/10/21 15:07:47 ballen4705 Exp $ +$Id: CHANGELOG,v 1.12 2002/10/21 16:00:46 ballen4705 Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -29,6 +29,18 @@ NOTES FOR NEXT RELEASE: smartmontools-5.0-11 + Previous versions of this code (and Smartsuite) only generate + SMART failure errors if the value of an attribute is below the + threshold and the prefailure bit is set. However the ATA Spec + (ATA4 <=Rev 4) says that it is a SMART failure if the value of an + attribute is LESS THAN OR EQUAL to the threshold and the + prefailure bit is set. This is now fixed in both smartctl and + smartd. + + smartd did not print the correct value of any failing SMART attribute. It + printed the index in the attribute table, not the attribute + ID. This is fixed. + when starting self-tests in captive mode ioctl returns EIO because the drive has been busied out. Detect this and don't return an eror in this case. Check this this is correct (or how to fix it?) diff --git a/sm5/TODO b/sm5/TODO index cbd0c7c4028c68e63de92737d35eccc5cc667b59..d92f43ee8bffd476ded1c68ca77c86c978398491 100644 --- a/sm5/TODO +++ b/sm5/TODO @@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> -$Id: TODO,v 1.8 2002/10/20 19:40:23 ballen4705 Exp $ +$Id: TODO,v 1.9 2002/10/21 16:00:46 ballen4705 Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -33,9 +33,14 @@ Produce version for ATA/ATAPI-7 Modifications ------------- + +Add option to show if the WORST recorded value is ever <= threshold +and if this is true with for an non-prefailure or prefailure attribute. + Command line option to specify devices to look for in smartd startup -Print flags meanings in Vendor Attribute list -- not hex value +Print flags meanings in Vendor Attribute list -- not hex value -- +especially for prefailure flag. When actual attribute(s) less than threshold, print these clearly (highlighted) diff --git a/sm5/atacmds.c b/sm5/atacmds.c index 72a2cc03a080166b03b88268425033c133acae94..36b5a598fe2f57547814f6a3e12c20580d342ba2 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -1,4 +1,4 @@ -// $Id: atacmds.c,v 1.12 2002/10/21 15:07:48 ballen4705 Exp $ +// $Id: atacmds.c,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $ /* * atacmds.c * @@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */ "reserved" /* 0x001f-0xfffe*/ }; +// NOTE ATA/ATAPI-4 REV 4 was the LAST revision where the device +// attribute structures were NOT completely vendor specific. So any +// disk that is ATA/ATAPI-4 or above can not be trusted to show the +// vendor values in sensible format. + + const int actual_ver[] = { /* word 81 value: */ 0, /* 0x0000 WARNING: */ @@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){ // Loop over all valid attributes. If they are prefailure attributes -// and are below the threshold value, then return the index of the -// lowest failing attribute. Return 0 if all prefailure attributes -// are in bounds. +// and are at or below the threshold value, then return the ID of the +// first failing attribute found. Return 0 if all prefailure +// attributes are in bounds. The spec says "Bit 0 +// -Pre-failure/advisory - If the value of this bit equals zero, an +// attribute value less than or equal to its corresponding attribute +// threshold indicates an advisory condition where the usage or age of +// the device has exceeded its intended design life period. If the +// value of this bit equals one, an atribute value less than or equal +// to its corresponding attribute threshold indicates a pre-failure +// condition where imminent loss of data is being predicted." + int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){ int i; @@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr if (data.vendor_attributes[i].id && thresholds.thres_entries[i].id && data.vendor_attributes[i].status.flag.prefailure && - (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && + (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) && (thresholds.thres_entries[i].threshold != 0xFE)) - return i; + return data.vendor_attributes[i].id; } return 0; } diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 2baefc1068e112e694c4901124a2a761766cfde4..7e9dccd4423e05b8a921c665f6391b217d3f855c 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -1,4 +1,4 @@ -// $Id: atacmds.cpp,v 1.12 2002/10/21 15:07:48 ballen4705 Exp $ +// $Id: atacmds.cpp,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $ /* * atacmds.c * @@ -76,6 +76,12 @@ const char *minor_str[] = { /* word 81 value: */ "reserved" /* 0x001f-0xfffe*/ }; +// NOTE ATA/ATAPI-4 REV 4 was the LAST revision where the device +// attribute structures were NOT completely vendor specific. So any +// disk that is ATA/ATAPI-4 or above can not be trusted to show the +// vendor values in sensible format. + + const int actual_ver[] = { /* word 81 value: */ 0, /* 0x0000 WARNING: */ @@ -598,9 +604,17 @@ int isSupportSelfTest (struct ata_smart_values data){ // Loop over all valid attributes. If they are prefailure attributes -// and are below the threshold value, then return the index of the -// lowest failing attribute. Return 0 if all prefailure attributes -// are in bounds. +// and are at or below the threshold value, then return the ID of the +// first failing attribute found. Return 0 if all prefailure +// attributes are in bounds. The spec says "Bit 0 +// -Pre-failure/advisory - If the value of this bit equals zero, an +// attribute value less than or equal to its corresponding attribute +// threshold indicates an advisory condition where the usage or age of +// the device has exceeded its intended design life period. If the +// value of this bit equals one, an atribute value less than or equal +// to its corresponding attribute threshold indicates a pre-failure +// condition where imminent loss of data is being predicted." + int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thresholds){ int i; @@ -608,9 +622,9 @@ int ataCheckSmart (struct ata_smart_values data, struct ata_smart_thresholds thr if (data.vendor_attributes[i].id && thresholds.thres_entries[i].id && data.vendor_attributes[i].status.flag.prefailure && - (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && + (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) && (thresholds.thres_entries[i].threshold != 0xFE)) - return i; + return data.vendor_attributes[i].id; } return 0; } diff --git a/sm5/ataprint.c b/sm5/ataprint.c index c20078a61c3baf48679af296f74a01dff542c238..05d3fa84b72916146e18afbc7affeaac9eb3df4d 100644 --- a/sm5/ataprint.c +++ b/sm5/ataprint.c @@ -1,4 +1,4 @@ -// $Id: ataprint.c,v 1.13 2002/10/20 19:22:02 ballen4705 Exp $ +// $Id: ataprint.c,v 1.14 2002/10/21 16:00:48 ballen4705 Exp $ /* * ataprint.c * @@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data, if (data.vendor_attributes[i].id && thresholds.thres_entries[i].id && data.vendor_attributes[i].status.flag.prefailure && - (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && + (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) && (thresholds.thres_entries[i].threshold != 0xFE)){ printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id); failed = 1; diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp index 4834cb2f3c649c84a3fca0d0c1586fe9237380bf..bfc6c5e07849063b8a47a38c725183217e70aad1 100644 --- a/sm5/ataprint.cpp +++ b/sm5/ataprint.cpp @@ -1,4 +1,4 @@ -// $Id: ataprint.cpp,v 1.13 2002/10/20 19:22:02 ballen4705 Exp $ +// $Id: ataprint.cpp,v 1.14 2002/10/21 16:00:48 ballen4705 Exp $ /* * ataprint.c * @@ -652,7 +652,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values data, if (data.vendor_attributes[i].id && thresholds.thres_entries[i].id && data.vendor_attributes[i].status.flag.prefailure && - (data.vendor_attributes[i].current < thresholds.thres_entries[i].threshold) && + (data.vendor_attributes[i].current <= thresholds.thres_entries[i].threshold) && (thresholds.thres_entries[i].threshold != 0xFE)){ printf("Attribute ID %i Failed\n",data.vendor_attributes[i].id); failed = 1;