Bug #1412

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

Added by Hasso Tepper over 2 years ago. Updated 6 months ago.

Status:Feedback Start date:
Priority:Normal Due date:
Assignee:Matthew Dillon % 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.
$


Related todos

History

Updated by Simon 'corecode' Schubert over 2 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

Updated by Matthew Dillon over 2 years ago

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

-Matt

Updated by Alex Hornung over 2 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

Updated by Matthew Dillon over 2 years ago

:Alex Hornung <ahornung@gmail.com> 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
<dillon@backplane.com>

Updated by Alex Hornung over 2 years ago

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

Updated by Antonio M. Huete Jimenez 6 months 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.

Also available in: Atom PDF