Opened 2 years ago

Last modified 21 months ago

#1586 new enhancement

DEVICESCAN -n standby could work for SCSI & SAS devices too

Reported by: tconnors Owned by:
Priority: minor Milestone: unscheduled
Component: smartd Version:
Keywords: scsi Cc:

Description (last modified by Christian Franke)

smartd.conf(5) says "-n POWERMODE" only works on ATA. My testing shows this might be true, even though smartctl(8) shows "-n POWERMODE" has experimental support for SCSI.

Either way, it shouldn't be too hard to make it work in the generic case. sdparm has a way to detect when a SCSI and SAS disk is spun down:

tconnors@pve:~$ for i in /dev/sd[b-gi-z] ; do echo $i ; sudo sdparm --command=sense $i ; done
/dev/sdb
    /dev/sdb: SEAGATE   ST4000NM0023      XMGJ
/dev/sdc
    /dev/sdc: SEAGATE   ST4000NM0023      XMGJ
/dev/sdd
    /dev/sdd: SEAGATE   ST6000NM0095      DS22
/dev/sde
    /dev/sde: SEAGATE   ST4000NM0023      XMGJ
/dev/sdf
    /dev/sdf: SEAGATE   ST6000NM0095      DS22
/dev/sdg
    /dev/sdg: TOSHIBA   MG04SCA60EE       DR07
/dev/sdi
    /dev/sdi: ATA       WDC WD10EAVS-32D  1A01
tconnors@pve:~$ for i in /dev/sd[b-gi-z] ; do echo $i ; sudo sg_start -r --pc=3 $i & done ; wait
/dev/sdb
[1] 1840017
/dev/sdc
[2] 1840018
/dev/sdd
[3] 1840019
/dev/sde
[4] 1840020
/dev/sdf
[5] 1840021
/dev/sdg
[6] 1840022
/dev/sdi
[7] 1840023
Illegal request
START STOP UNIT command failed
sg_start failed: Illegal request

tconnors@pve:~$ for i in /dev/sd[b-gi-z] ; do echo $i ; sudo sdparm --command=sense $i ; done
/dev/sdb
    /dev/sdb: SEAGATE   ST4000NM0023      XMGJ
Additional sense: Standby condition activated by command
/dev/sdc
    /dev/sdc: SEAGATE   ST4000NM0023      XMGJ
Additional sense: Standby condition activated by command
/dev/sdd
    /dev/sdd: SEAGATE   ST6000NM0095      DS22
Additional sense: Standby condition activated by command
/dev/sde
    /dev/sde: SEAGATE   ST4000NM0023      XMGJ
Additional sense: Standby condition activated by command
/dev/sdf
    /dev/sdf: SEAGATE   ST6000NM0095      DS22
Additional sense: Standby condition activated by command
/dev/sdg
    /dev/sdg: TOSHIBA   MG04SCA60EE       DR07
Additional sense: Standby condition activated by command
/dev/sdi
    /dev/sdi: ATA       WDC WD10EAVS-32D  1A01

Change History (3)

comment:1 by Christian Franke, 2 years ago

Component: allsmartd
Description: modified (diff)
Keywords: scsi added
Milestone: unscheduled
Summary: DEVICESCAN -d standby could work for SCSI & SAS devices tooDEVICESCAN -n standby could work for SCSI & SAS devices too

comment:2 by Nick Maynard, 21 months ago

I would be exceptionally interested in this. I have 12 SAS Seagate drives, which I've managed to get spinning down via the various condition timers, but smartd spins them up every 30 minutes for its polling behaviour. Obviously this is bad for both power usage and longevity.

I've managed to work around the issue by pushing the global polling interval to once per day, but it's not the right answer, as the attached ATA drives no longer get properly polled.

It seems that sense key 5e https://www.t10.org/lists/asc-num.htm#ASC_5E shows the current state - I'd venture that the states here could be used as an analogue for those in -n.

Ideally, it'd be great to expand this to handle the various states too (IDLE, IDLE_B, IDLE_C, STANDBY_Y, STANDBY), but collapsing these to IDLE, STANDBY would be a very welcome first step.

comment:3 by Nick Maynard, 21 months ago

I've worked around this problem in Munin's hddtemp_smartctl code (https://github.com/munin-monitoring/munin/issues/1484) but the real answer lies, of course, in adding this capability to smartctl and smartd.

I'll apologise now for not issuing any patches, PRs for this. I'm afraid my C (of any variety) is unused for over 20 years, so I'd be more of a liability than an asset!

Note: See TracTickets for help on using tickets.