Bug #3149
closedSMART status widget always displays error with SCSI drives
0%
Description
(As of 2.1-RC1 (i386) built on Wed Aug 14 14:47:17 EDT 2013 FreeBSD 8.3-RELEASE-p9)
The SMART widget always displays red bars even though the disks are fine and reporting no errors.
line 50 in /usr/local/www/widgets/widgets/smart_status_widget greps for "result", but the output of "smartctl -H" on my system looks like this:
smartctl 6.1 2013-03-16 r3800 [FreeBSD 8.3-RELEASE-p9 i386] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
...obviously "result" does not appear in there anywhere, so the test fails and the widget shows me failing disks.
I'm guessing smartctl has different output for SCSI disks than for ATA disks?
For reference:
diskinfo -v /dev/da0:
/dev/da0
512 # sectorsize
72839168000 # mediasize in bytes (67G)
142264000 # mediasize in sectors
0 # stripesize
0 # stripeoffset
8855 # Cylinders according to firmware.
255 # Heads according to firmware.
63 # Sectors according to firmware.
DAL1P6B0K8040646 # Disk ident.
smartctl -a /dev/da0:
smartctl 6.1 2013-03-16 r3800 [FreeBSD 8.3-RELEASE-p9 i386] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF INFORMATION SECTION ===
Vendor: COMPAQ
Product: BD07289BB8
Revision: HPB1
User Capacity: 72,839,168,000 bytes [72.8 GB]
Logical block size: 512 bytes
Rotation Rate: 10025 rpm
Logical Unit id: 0x00000e1100dcd8c8
Serial number: DAL1P6B0K8040646
Device type: disk
Transport protocol: Parallel SCSI (SPI-4)
Local Time is: Fri Aug 16 10:30:31 2013 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Enabled=== START OF READ SMART DATA SECTION ===
SMART Health Status: OKCurrent Drive Temperature: 35 C
Drive Trip Temperature: 65 CManufactured in week 46 of year 2006
Specified cycle count over device lifetime: 10000
Accumulated start-stop cycles: 43
Elements in grown defect list: 0Error counter log:
Errors Corrected by Total Correction Gigabytes Total
ECC rereads/ errors algorithm processed uncorrected
fast | delayed rewrites corrected invocations [10^9 bytes] errors
read: 0 0 0 0 0 0.000 0
write: 0 0 0 0 0 0.000 0Non-medium error count: 187
No self-tests have been logged
(I also accidentally created this as ToDo #3148, but I can't delete it myself.)
Files
Updated by Adam Thompson almost 12 years ago
This seems to fix it, at least for my case, but I don't have an ATA-based system handy to verify I didn't break it for that case:
--- smart_status.widget.php.orig 2013-08-16 10:39:03.000000000 0500 $dev_state = exec("smartctl -H /dev/$dev | grep result: | awk '{print $6}'"); ## get SMART state from drive
++ smart_status.widget.php 2013-08-16 10:40:43.000000000 -0500@ -47,9 +47,10
@
if(count($devs) > 0) {
foreach($devs as $dev) { ## for each found drive do
$dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); ## get identifier from drive
$dev_state = exec("smartctl -H /dev/$dev | awk '/result/ {print $6}
+/^SMART Health Status/ {print $4}'"); ## get SMART state from drive
# Use light green color for passed, light coral otherwise.
- $color = ($dev_state "PASSED") ? "#90EE90" : "#F08080";
+ $color = ($dev_state "PASSED" || $dev_state == "OK") ? "#90EE90" : "#F08080";
?>
<tr>
<td class="listlr"></td>
Updated by Adam Thompson almost 12 years ago
- File smart_status.widget.diff smart_status.widget.diff added
OK, that formatting was just a teensy bit annoying... see attached.
Updated by Jim Pingle almost 12 years ago
- Status changed from New to Needs Patch
IIRC that is the default behavior until you have run a self-test on the drive, whether it is IDE or SCSI.
If someone wants to put some better logic/display there, feel free.
Updated by Adam Thompson almost 12 years ago
Nope... even after running a self-test, the output from "smartctl -H" remains unchanged. SCSI drives do SMART differently than ATA drives do, and I recall this being one of the differences. Would you be happier with something along the lines of
if( $dev_state == "" ) then $dev_state = "(no usable information)";
since at least that would give the user a clue that his drive doesn't report anything useful?
Can you show me the output of "smartctl -H" and "smartctl -a" from an ATA device, and I'll put together a patch that covers both cases?
Updated by Adam Thompson almost 12 years ago
- File smart_status.widget.diff smart_status.widget.diff added
I've now confirmed across multiple versions of multiple operating systems that SCSI drives consistently report "SMART Health Status: OK" whereas IDE and SATA drives consistently report "SMART overall-health self-assessment test result: PASSED".
RAID cards (that support querying this) generally report the relevant text based on what the physical drive is, i.e. my Dell PERC array with SATA drives reports the same way a SATA drive would. I don't have any MegaRAID SCSI arrays handy right now to test.
I don't have any SAS drives handy to test against. MegaRAID, 3ware, et al. require a different command-line altogether (e.g. "smartctl -H /dev/sda -d megaraid,1") so the patch will just give them "unknown" in yellow.
So my original patch does take care of those two cases, but I've cleaned it up anyway to be a bit more explicit (and to make it more obvious how to extend it for other future cases).
Updated by Kill Bill almost 10 years ago
This has been fixed by https://github.com/pfsense/pfsense/commit/eb0287e96f01ea0880d3ccce762d6880b2b44792
Updated by Renato Botelho almost 10 years ago
- Status changed from Needs Patch to Resolved