[2246] in linux-scsi channel archive
Re: How to turn power off on an idle scsi drive.
daemon@ATHENA.MIT.EDU (Hein Roehrig)
Mon Aug 4 18:12:55 1997
From: Hein Roehrig <roehrig@mpi-sb.mpg.de>
To: linux-scsi@vger.rutgers.edu
Date: Mon, 4 Aug 1997 23:14:10 +0200 (MET DST)
Cc: rjohanne@piper.hamline.edu
Robert Johannes <rjohanne@piper.hamline.edu> wrote:
> How do I turn power off to a scsi drive if it is not in use?
[...]
> Would that affect the termination of the operating scsi drive?
There is an SCSI command an a corresponding ioctl to power up/down a
SCSI drive. From the scsi-idle patch:
struct sdata {
int inlen;
int outlen;
union {
unsigned char cmd[6];
unsigned char sense_buffer[16];
} d;
} buf;
buf.d.cmd[0]=START_STOP;
buf.d.cmd[1]=1; /* Immed = 1 */
buf.d.cmd[2]=0;
buf.d.cmd[3]=0;
buf.d.cmd[4]=onoff?1:0; /* LoEj = 0 */
buf.d.cmd[5]=0;
buf.inlen=buf.outlen=0;
if (ioctl(devfd, SCSI_IOCTL_SEND_COMMAND, &buf)!=0)
error();
Unless you apply the scsi-idle patch (which is being used with varying
success by different people, it works pretty well for me), you should
not do this on a drive which gets accessed by Linux.
Active termination on the device to be powered down could be a
problem, probably some SCSI guru here can comment on that.
Cheers,
Hein