Bug #1412

sysutils/smartmontools doesn't work with ahci(4)

Added by hasso almost 5 years ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:alexh% Done:

0%

Category:-
Target version:-

Description

sysutils/smartmontools doesn't work with devices attached to ahci(4), using
nata(4) works fine. Cheating and specifying device type doesn't help either:

$ sudo smartctl -a /dev/da0
smartctl version 5.38 [i386-pc-dragonfly] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: SATA Hitachi HDT72502 Version: V5DO
Serial number: VFL101R60YS8GF
Device type: disk
Local Time is: Sat Jun 27 22:26:55 2009 EEST
Device does not support SMART
Request Sense failed, [Operation not permitted]

Error Counter logging not supported
Device does not support Self Test logging
$
$
$ sudo smartctl -d ata -a /dev/da0
smartctl version 5.38 [i386-pc-dragonfly] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Smartctl: Device Read Identity Failed (not an ATA/ATAPI device)

A mandatory SMART command failed: exiting. To continue, add one or more '-T
permissive' options.
$

History

#1 Updated by corecode almost 5 years ago

Matthew Dillon wrote:
> SMART uses ata-specific ioctls which the AHCI driver does not implement.

But the drives support SMART querying and I think also SCSI drives
support (something like) it.

cheers
simon

#2 Updated by dillon almost 5 years ago

SMART uses ata-specific ioctls which the AHCI driver does not implement.

-Matt

#3 Updated by alexh over 4 years ago

Ok, I think one should use device type 'sat' for smartmontools (ata over scsi,
or scsi attached ata). For this to be feasible, ATA_PASS_* have to be
implemented in our ahci driver.
Relevant snippet in ahci_cam.c:
case ATA_PASS_12:
case ATA_PASS_16:
/*
* XXX implement pass-through
*/
ccbh->status = CAM_FUNC_NOTAVAIL;
break;

I'll give it a shot, but any hint is welcome.

Cheers,
Alex Hornung

#4 Updated by dillon over 4 years ago

:Alex Hornung <> added the comment:
:
:Ok, I think one should use device type 'sat' for smartmontools (ata over sc=
:si,=20
:or scsi attached ata). For this to be feasible, ATA_PASS_* have to be=20
:implemented in our ahci driver.
:Relevant snippet in ahci_cam.c:
: case ATA_PASS_12:
: case ATA_PASS_16:
: /*
: * XXX implement pass-through
: */
: ccbh->status =3D CAM_FUNC_NOTAVAIL;
: break;
:
:I'll give it a shot, but any hint is welcome.
:
:Cheers,
:Alex Hornung

The best place to get examples is probably ahci_cam.c... the probe code
runs a number of discrete ATA commands. It is fairly straightforward. I'm
not sure how ATAPI is distinguished from ATA w/ regards to the pass-thru
ioctls though.

-Matt
Matthew Dillon
<>

#5 Updated by alexh over 4 years ago

Fixed with commit bedbe7f88177daf6a0e404f198ef852b8e9b426b and using 'sat' as
device type for smartctl.

#6 Updated by tuxillo over 2 years ago

Health check failing:

cocaine# smartctl -d sat -H /dev/da0
smartctl 5.40 2010-10-16 r3189 [DragonFly 2.11-DEVELOPMENT x86_64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
Error SMART Status command failed
Please get assistance from http://smartmontools.sourceforge.net/
Register values returned from SMART Status command are:
ERR=...., SC=...., LL=...., LM=...., LH=...., DEV=...., STS=....
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

#7 Updated by alexh about 2 years ago

  • Assignee changed from dillon to alexh
  • Priority changed from Normal to Low

Works here on the internal disk.

15:33:11 dfhybrid:~
4 # dmesg | grep da0
disk scheduler: set policy of da0 to noop
da0 at ahci0 bus 0 target 0 lun 0
da0: <SATA ST9500420AS 0003> Fixed Direct Access SCSI-4 device
da0: Serial Number 5VJB5EP9
da0: 300.000MB/s transfers
da0: 476940MB (976773168 512 byte sectors: 255H 63S/T 60801C)

2 # smartctl -a -d sat /dev/da0
smartctl 5.40 2010-10-16 r3189 [DragonFly 3.1-DEVELOPMENT x86_64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family: Seagate Momentus 7200.4 series
Device Model: ST9500420AS
Serial Number: 5VJB5EP9
Firmware Version: 0003LVM1
User Capacity: 500,107,862,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
Local Time is: Wed Feb 29 15:33:10 2012 GMT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

#8 Updated by alexh about 2 years ago

Also works on the external ESATA disk:

15:36:28 dfhybrid:~
4 # dmesg | grep da1
disk scheduler: set policy of da1 to noop
da1 at ahci0 bus 3 target 0 lun 0
da1: <SATA WDC WD3200BEVT-2 11.0> Fixed Direct Access SCSI-4 device
da1: Serial Number WD-WXE308K75174
da1: 300.000MB/s transfers
da1: 305245MB (625142448 512 byte sectors: 255H 63S/T 38913C)
da1s2: cannot find label (no disk label)
da1s2: cannot find label (no disk label)
da1s2: cannot find label (no disk label)
da1s2: cannot find label (no disk label)
da1s2: cannot find label (no disk label)
da1s2: cannot find label (no disk label)
15:36:30 dfhybrid:~
# smartctl -a -d sat /dev/da1
smartctl 5.40 2010-10-16 r3189 [DragonFly 3.1-DEVELOPMENT x86_64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family: Western Digital Scorpio Blue Serial ATA family
Device Model: WDC WD3200BEVT-22ZCT0
Serial Number: WD-WXE308K75174
Firmware Version: 11.01A11
User Capacity: 320,072,933,376 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Wed Feb 29 15:36:32 2012 GMT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

#9 Updated by alexh over 1 year ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF