[Scsirastools-developers] RE: sgdiag, STOP_UNIT, and ATA-in-USB caddies
Brought to you by:
arcress
From: Cress, A. R <and...@in...> - 2004-11-22 13:49:17
|
Alex, You could test it by using sgdiag: c - to compose a command 4 =3D length E4 (or 99) 00 00 00 Response Data Length =3D 2 (this length probably doesn't matter) Output Data Length =3D 0 =20 Then, if it works, you can see how this is coded in sgdiag.c and make your own version of the program with a special ATA sleep option. Andy -----Original Message----- From: Alex Butcher [mailto:ale...@as...]=20 Sent: Saturday, November 20, 2004 9:27 AM To: Cress, Andrew R Subject: RE: sgdiag, STOP_UNIT, and ATA-in-USB caddies Hi Andy - On Thu, 18 Nov 2004, Cress, Andrew R wrote: > You may need to contact Maxtor to get a tool or API function that will > accept the spin down for ATA. If there is a command that the ATA device > will accept, it could be sent via sg encapsulation, I think. In fact, > the 'c' option would allow such a command to be composed. According to the source for hdparm and <http://my.execpc.com/~geezer/osd/misc/ata-idle.c>, the equivalent command is SLEEP, which is defined as 0xe6 or 0x99. hdparm does the following to send a drive to sleep: if (set_sleepnow) { #ifndef WIN_SLEEPNOW1 #define WIN_SLEEPNOW1 0xE6 #endif #ifndef WIN_SLEEPNOW2 #define WIN_SLEEPNOW2 0x99 #endif unsigned char args1[4] =3D {WIN_SLEEPNOW1,0,0,0}; unsigned char args2[4] =3D {WIN_SLEEPNOW2,0,0,0}; if (get_sleepnow) printf(" issuing sleep command\n"); if (ioctl(fd, HDIO_DRIVE_CMD, &args1) && ioctl(fd, HDIO_DRIVE_CMD, &args2)) perror(" HDIO_DRIVE_CMD(sleep) failed"); } With the exception of Seagate, these commands appear to be standard ATA. Now, any ideas on how I can construct an equivalent SCSI CDB? > Andy Cheers, Alex. > > -----Original Message----- > From: Alex Butcher [mailto:ale...@as...] > Sent: Thursday, November 18, 2004 2:12 PM > To: Cress, Andrew R > Subject: sgdiag, STOP_UNIT, and ATA-in-USB caddies > > > Hi - > > I've been looking for a tool to spin down the various ATA discs that I > have > USB caddies. scsi-spin and scsi-idle use an ioctl that's deprecated > under > Linux kernel 2.6.9 (the kernel logs a message saying to port to SG_IO), > but > your sgdiag appears to fit the bill. Unfortunately, when I try to send > the > STOP_UNIT command, I get the following: > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D > sgdiag utility v1.12 for SCSI disks > ****************************************** > Log file /var/log/sgdiag.log is open, debug=3D0 > > Num Name [bus:ch:id:lun] Type Vendor Device_Model FW Serial# Size > 0 /dev/sg0 [1:0:0:0] Disk Maxtor 5 3073U6 DA62 [em] > > c =3D Compose Command to send 1 =3D Do bug 1 (sense_len =3D 18) > r =3D Reset SCSI bus 2 =3D Do bug 2 (INQ hang) > i =3D Special Ser# Inquiries 3 =3D Do bug 3 (fmt w short timeout) > f =3D Format SCSI disk w =3D Wipe SCSI disk (fmt wo glist) > s =3D Start Unit d =3D Send Diagnostic self-test > t =3D sTop Unit > Enter Selection ('q' to quit) : t > > Device Num (0 to 0) : 0 > Issuing stop_unit for /dev/sg0 > stop_unit: Check Condition Driver_status=3D0x08 (DRIVER_SENSE,SUGGEST_OK) > sense error, key=3D05 asc=3D20 ascq=3D00 Illegal Request, Invalid = command > operation code > Info valid=3D0, Current > stop_unit complete, status =3D -2 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D > > I know this is not the intended use of this tool, but I'd appreciate > your > opinions on what's up, and whether it's possible to workaround it. > Normally, > I'd use hdparm -Y to spin down ATA drives, but as they show up as > pseudo-SCSI > devices when used with Linux's usb-storage driver, hdparm refuses to > handle > them. :-( > > Best Regards, > Alex. > --=20 Alex Butcher Brainbench MVP for Internet Security: www.brainbench.com Bristol, UK Need reliable and secure network systems? PGP/GnuPG ID:0x271fd950 <http://www.assursys.com/> |