Skip to contentSkip to conversation

sdparm cannot start or stop SATA disks

DISCUSSION Douglas Gilbert 3 participants 7 messages Jul 29, 2005 – Jul 30, 2005 SCSI

lore
Share & tools
lore
#0 lore raw

Putting this post on this list might head off more (private) emails on this subject.

sdparm uses the START STOP UNIT SCSI command to start and stop (spin up and spin down) SCSI devices. Currently libata does not implement that SCSI command. [Hopefully Jeff contradicts me.]

Has anybody seen a USB or 1394 enclosure that implements START STOP UNIT? [The command is defined in SBC, MMC and RBC.]

Doug Gilbert

#1 lore raw
Quoted 11 lines · Douglas Gilbert

Putting this post on this list might head off more (private) emails on this subject.

sdparm uses the START STOP UNIT SCSI command to start and stop (spin up and spin down) SCSI devices. Currently libata does not implement that SCSI command. [Hopefully Jeff contradicts me.]

Has anybody seen a USB or 1394 enclosure that implements START STOP UNIT? [The command is defined in SBC, MMC and RBC.]

Hi Douglas,
After our previous discussion on USB/Firewire start/stop, I asked on our dk LUG for info on external interfaces, but found none that seems to implement the needed SCSI functionality. Too bad, would've been great being able to spin an external drive down/up as needed.

I think I read somewhere that one ATA disk (HItachi og Fujitsu) can do something similar automatically (i.e. adhering to a timeout), once configured to do so, using MS-based utils. Dunno if those/similar are available for *nix.

Signature · 6 lines
Kind regards,
Mogens Valentin


2.6.12 rocks. I love the Conservative governor (not Arnold)..
  -- bird603568, on linuxquestions.org
#2 lore raw
In reply to Douglas Gilbert
Quoted 4 lines · Douglas Gilbert

sdparm uses the START STOP UNIT SCSI command to start and stop (spin up and spin down) SCSI devices. Currently libata does not implement that SCSI command. [Hopefully Jeff contradicts me.]

Correct.

Someone should submit a libata patch for this!

Jeff

#3 lore raw
Quoted 11 lines · Jeff Garzik
Quoted 4 lines · Douglas Gilbert

sdparm uses the START STOP UNIT SCSI command to start and stop (spin up and spin down) SCSI devices. Currently libata does not implement that SCSI command. [Hopefully Jeff contradicts me.]

Correct.

Someone should submit a libata patch for this!

Jeff,
I could have a go at the SCSI half of it. According to SAT, START STOP UNIT should only be allowed for non-packet ATA devices. I assume your SATAPI code will the bypass libata-scsi.c SAT layer.

SAT suggests libata should issue a ATA STANDBY (sector=0) to "stop" the device. I can't see the STANDBY command (0xE2) defined anywhere in libata or the ide subsystem (or their headers).

The action to start the SATA device depends on the power mode of the SATA device:
- SLEEP: send a hardware or software reset: that should get it to ACTIVE or STANDBY mode
- STANDBY or IDLE: send a (READ) VERIFY (sector=0) ATA to the command
- ACTIVE: I assume this would be a nop

The START STOP UNIT SCSI command also has an "IMMED"iate bit. That could just be ignored initially.

Is half a patch any use?

Doug Gilbert

#4 lore raw
Quoted 4 lines · Douglas Gilbert

I could have a go at the SCSI half of it. According to SAT, START STOP UNIT should only be allowed for non-packet ATA devices. I assume your SATAPI code will the bypass libata-scsi.c SAT layer.

Mostly. There is still a few translation bits in there. 99% bypass, not 100%.

Quoted 4 lines

SAT suggests libata should issue a ATA STANDBY (sector=0) to "stop" the device. I can't see the STANDBY command (0xE2) defined anywhere in libata or the ide subsystem (or their headers).

I'm sure you're capable of adding an enum to linux/ata.h :)

Quoted 8 lines

The action to start the SATA device depends on the power mode of the SATA device:
- SLEEP: send a hardware or software reset: that should get it to ACTIVE or STANDBY mode
- STANDBY or IDLE: send a (READ) VERIFY (sector=0) ATA to the command
- ACTIVE: I assume this would be a nop

Quoted 4 lines

The START STOP UNIT SCSI command also has an "IMMED"iate bit. That could just be ignored initially.

Is half a patch any use?

Sure.

Jeff

#5 lore raw
In reply to Jeff Garzik
Quoted 11 lines · Jeff Garzik
Quoted 4 lines · Douglas Gilbert

sdparm uses the START STOP UNIT SCSI command to start and stop (spin up and spin down) SCSI devices. Currently libata does not implement that SCSI command. [Hopefully Jeff contradicts me.]

Correct.

Someone should submit a libata patch for this!

Jeff,
A further thought about implementing the START STOP UNIT SCSI command in libata: the TEST UNIT READY SCSI command should become more than just a no-op.

Additional sense code 4 ("Logical unit not ready, ...") seems to have a special for SAS (including SAS's ability to hold a SATA disk spun down at power on):
ASC/ASCQ=[0x4,0x11] "Logical unit not ready, notify (enable spinup) required".

Doug Gilbert

#6 lore raw
Quoted 3 lines · Douglas Gilbert

A further thought about implementing the START STOP UNIT SCSI command in libata: the TEST UNIT READY SCSI command should become more than just a no-op.

Correct.

Jeff