Opened 13 years ago

Closed 13 years ago

#91 closed defect (fixed)

smartctl, standby mode not detected properly on FreeBSD

Reported by: drsweety Owned by: Dan Lukes
Priority: minor Milestone: Release 5.40
Component: all Version: 5.39.1
Keywords: freebsd Cc:

Description

Hi!

I've enabled the standby timer on all my harddisks with "camcontrol standby adaX -t 900" (=which sends the STANDBY ATA cmd to the drive (=idle now, arm standby timer to 900s)). This works fine and "smartctl" recognises that the drive is in standby mode:

# smartctl -A -n standby /dev/ada3
smartctl 5.39.1 2010-01-28 r3054 [FreeBSD 8.1-RELEASE amd64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Device is in STANDBY mode, exit(2)
# camcontrol cmd ada3 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r -
50 00 00 00 00 40 00 00 00 00 00

However, if a drive is currently active it still thinks that the drive is in standby mode even though it clearly is not:

# dd if=/dev/ada0 of=/dev/null count=1
1+0 records in
1+0 records out
512 bytes transferred in 0.034235 secs (14955 bytes/sec)
# ./smartctl -A -n standby /dev/ada0
smartctl 5.39.1 2010-01-28 r3054 [FreeBSD 8.1-RELEASE amd64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Power mode: 00
Device is in STANDBY mode, exit(2)
# camcontrol cmd ada0 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r -
50 00 00 00 00 00 00 00 00 FF 00
#

Note that the "Power mode: 00" output was added by me to atacmds.cpp for debugging purposes. It outputs the value of "result" from within "ataCheckPowerMode". As you can see from the "camcontrol" output the device is active (sector count=FF). I'm not sure why the output for sector count from "camcontrol" and "smartctl" differ... Is this working as designed?

Attachments (1)

freebsd_powercheck.patch (639 bytes ) - added by bdheller 13 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Christian Franke, 13 years ago

The sector_count value may not be passed by os_freebsd.cpp to atacmds.cpp.

Please provide output of: smartctl -r ioctl -n standby /dev/ada3

comment:2 by Gabriele Pohl, 13 years ago

Keywords: freebsd added; FreeBSD standby removed

comment:3 by bdheller, 13 years ago

I ran into the same problem. To get things going on a fix, here is the requested output:

smartctl -r ioctl -n standby /dev/ada10
smartctl 5.39.1 2010-01-28 r3054 [FreeBSD 8.1-RELEASE amd64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net


REPORT-IOCTL: Device=/dev/ada10 Command=CHECK POWER MODE
 Input:   FR=...., SC=...., LL=...., LM=...., LH=...., DEV=...., CMD=0xe5
 Output: ERR=...., SC=0x00, LL=...., LM=...., LH=...., DEV=...., STS=....
REPORT-IOCTL: Device=/dev/ada10 Command=CHECK POWER MODE returned 0
Device is in STANDBY mode, exit(2)
camcontrol cmd ada10 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r -
50 00 00 00 00 00 00 00 00 FF 00

by bdheller, 13 years ago

Attachment: freebsd_powercheck.patch added

comment:4 by bdheller, 13 years ago

I have attached a patch against 5.39.1 that works for me.

comment:5 by Christian Franke, 13 years ago

Component: smartctlall
Milestone: Release 5.40

comment:6 by Dan Lukes, 13 years ago

Owner: changed from somebody to Dan Lukes
Status: newaccepted

comment:7 by Dan Lukes, 13 years ago

Resolution: fixed
Status: acceptedclosed

Tested on FreeBSD 8.1-R i386 and FreeBSD 8.1-R amd64

committed slightly different patch than the one attached by bdheller, but difference is in formatting only

Note: See TracTickets for help on using tickets.