Skip to contentSkip to conversation

sdparm 0.92

ANNOUNCE Douglas Gilbert 3 participants 7 messages May 20, 2005 – May 25, 2005 3 messages not in the archive SCSI

lore
Share & tools
lore
#0 lore raw

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). More generally it gets and sets mode page information on SCSI devices or devices that use a SCSI command set (e.g. CD/DVD drives (any transport) and SCSI tape drives). It also can list VPD pages including the device identification page.

For more information and downloads (tarball, rpm and deb packages) see:
http://www.torque.net/sg/sdparm.html

There are now more than 150 parameters accessed by sdparm. Thanks to Kai Makisara for interface and sanity checking suggestions.

ChangeLog for sdparm-0.92 [20050520]
- add data compression and device configuration mode pages (ssc3)
- add timeout + protect plus write parameters mode pages (mmc5)
- add XOR control mode page (sbc2)
- add SES management mode page (ses2)
- discriminate mode pages based on device's peripheral device type
- disallow set/clear acronyms whose pdt doesn't match current device
- with option "-ll" decode more of INQUIRY standard response
- improve error checking when getting non-existent fields
- use double fetch technique when fetching mode pages
- add RBC device parameters mode page (rbc)
- add '--flexible' option for mode sense 6/10 response mixup
- '--inquiry -all' now outputs supported VPD pages page

Doug Gilbert

#1 lore raw
Quoted 7 lines · Douglas Gilbert

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). More generally it gets and sets mode page information on SCSI devices or devices that use a SCSI command set (e.g. CD/DVD drives (any transport) and SCSI tape drives). It also can list VPD pages including the device identification page.

Quoted 5 lines

For more information and downloads (tarball, rpm and deb packages) see:
http://www.torque.net/sg/sdparm.html

There are now more than 150 parameters accessed by sdparm.

This has gone beyond "creeping featurism" to cavorting and gamboling featurism! ;-)

I pulled a copy to try over the long weekend if not before, this looks as if it will be a valuable documentation tool, which is useful to CYA even if never used otherwise.

#2 lore raw
In reply to Douglas Gilbert
Quoted 10 lines · Douglas Gilbert

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). More generally it gets and sets mode page information on SCSI devices or devices that use a SCSI command set (e.g. CD/DVD drives (any transport) and SCSI tape drives). It also can list VPD pages including the device identification page.

For more information and downloads (tarball, rpm and deb packages) see:
http://www.torque.net/sg/sdparm.html

Nice! Just got it and tried on an external usb disk. One feature I could use, probably others as well:
Could you add the ability to spin down/up a scsi disk? I'd really like this for exteral (usb) disks.

Doesn't seem it can; if I missed it, I'm sorry..

Signature · 2 lines
Kind regards,
Mogens Valentin
#3 lore raw
Quoted 14 lines · Mogens Valentin
Quoted 10 lines · Douglas Gilbert

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). More generally it gets and sets mode page information on SCSI devices or devices that use a SCSI command set (e.g. CD/DVD drives (any transport) and SCSI tape drives). It also can list VPD pages including the device identification page.

For more information and downloads (tarball, rpm and deb packages) see:
http://www.torque.net/sg/sdparm.html

Quoted 4 lines

Nice! Just got it and tried on an external usb disk. One feature I could use, probably others as well:
Could you add the ability to spin down/up a scsi disk? I'd really like this for exteral (usb) disks.

Mogens,
With sg_start (in the sg3_utils package) I have tried to spin up and down an ATA disk inside a USB enclosure without success. The same command on a USB connected CD/DVD combo drive did work.

Could you try sg_start on your USB external enclosure which I assume contains an ATA disk rather than a SCSI (SPI) disk and report if it works?

BTW I just checked libata (for SATA disks) and it does not seem to support the START STOP UNIT command. Jeff, could that one be added?

Quoted 1 line

Doesn't seem it can; if I missed it, I'm sorry..

It is hard to know where to stop with sdparm ;-) At the moment I am adding transport (protocol) specific mode page support. So currently sdparm specializes in mode pages (for all SCSI command sets) and INQUIRY information (including the device identification VPD page).

Doug Gilbert

#4 lore raw
Quoted 18 lines · Douglas Gilbert
Quoted 9 lines · Mogens Valentin
Quoted 2 lines · Douglas Gilbert

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). ..snip..

Nice! Just got it and tried on an external usb disk. One feature I could use, probably others as well:
Could you add the ability to spin down/up a scsi disk? I'd really like this for exteral (usb) disks.

Mogens,
With sg_start (in the sg3_utils package) I have tried to spin up and down an ATA disk inside a USB enclosure without success. The same command on a USB connected CD/DVD combo drive did work.

Quoted 3 lines

Could you try sg_start on your USB external enclosure which I assume contains an ATA disk rather than a SCSI (SPI) disk and report if it works?

Sure. Got it, compiled, but got the error:
.../usr/include/scsi/sg.h /usr/include/scsi/scsi.h
/usr/include/stdint.h sg_lib.h sg_cmds.h llseek.h
gcc: cannot specify -o with -c or -S and multiple compilations
make: *** [sgp_dd.o] Error 1

I could only find -o and -c in the makefiles around line 95.

Slack 9.1 / 2.6.10 from sources.

It's 4am, I'm off to bed, sorry :p

Signature · 2 lines
Kind regards,
Mogens Valentin

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 66 lines · Douglas Gilbert
Quoted 57 lines · Mogens Valentin
Quoted 33 lines · Douglas Gilbert
Quoted 31 lines · Mogens Valentin
Quoted 12 lines · Douglas Gilbert
Quoted 9 lines · Mogens Valentin
Quoted 2 lines · Douglas Gilbert

sdparm is a command line utility designed to get and set SCSI disk parameters (cf hdparm for ATA disks). ..snip..

Nice! Just got it and tried on an external usb disk. One feature I could use, probably others as well:
Could you add the ability to spin down/up a scsi disk? I'd really like this for exteral (usb) disks.

Quoted 8 lines

With sg_start (in the sg3_utils package) I have tried to spin up and down an ATA disk inside a USB enclosure without success. The same command on a USB connected CD/DVD combo drive did work.

Could you try sg_start on your USB external enclosure which I assume contains an ATA disk rather than a SCSI (SPI) disk and report if it works?

Sure. Got it, compiled, but got the error:
.../usr/include/scsi/sg.h /usr/include/scsi/scsi.h
/usr/include/stdint.h sg_lib.h sg_cmds.h llseek.h
gcc: cannot specify -o with -c or -S and multiple compilations
make: *** [sgp_dd.o] Error 1

I could only find -o and -c in the makefiles around line 95.

Quoted 7 lines
Quoted 3 lines

Slack 9.1 / 2.6.10 from sources.

It's 4am, I'm off to bed, sorry :p

Could you try the sg3_utils-1.15.tgz beta at the top of http://www.torque.net/sg [in the news section]. Hopefully that cures the compile problem.

Nope, but it changes the error. You changed the makefile exactly as I tried it, removing '-c' in line 95. This results in missing header files compiles:

...
creating sg_dd
gcc -g -O2 -Wall -W -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -c sgp_dd.c ...
.../usr/include/stdint.h sg_lib.h sg_cmds.h llseek.h
gcc: compilation of header file requested
gcc: compilation of header file requested
...
make: *** [sgp_dd.o] Error 1

Quoted 4 lines

Forgot to mention I have gcc version 3.2.3, FWIW..
It's not exactly an uncommon problem; I googled a bit :p
I haven't pinpointed the problem as yet, but found comments (from compiling other apps) that it could be either a gcc versioning problem, a problem with -I or -D switches, or simply a Makefile problem.

I can make that compile file as well if I place rubbish in the INCLUDES environment variable; for example:

Quoted 7 lines
 # export INCLUDES=hello.h
 # make sgp_dd
gcc hello.h -g -O2 -Wall -W -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 
-D_REENTRANT -c sgp_dd.c
gcc: hello.h: No such file or directory
make: *** [sgp_dd.o] Error 1

Ehh.. I don't follow you here..
INCLUDES seems left undefined and hence evaluates empty, so yes, you can provoke an error by defining some nonsense, but since I cannnot compile, something's wrong: my gcc version, your makefile, or my (½empty) mind.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Even if it doesn't you can 'make sg_start' to get the sg_start executable. 'man ./sg_start' will give you the usage information.

That I could do, doing the 1.15 version.
Oh, it's man ./sg_start.8 ..

Quoted 6 lines

Of course.

Quoted 2 lines

Hmm, couldn't run sg_start:
.libs/sg_start: error while loading shared libraries: libsgutils.so.1: cannot open shared object file: No such file or directory

./sg_start in the compile directory should work.

My mistake..

Quoted 43 lines
Quoted 10 lines

No wonder, since libs hadn't been installed, so I copied them to /usr/local/lib . Now sg_start runs, but... :

bash-2.05b# .libs/sg_start 0 /dev/sdc
start_stop: SCSI status: Check Condition
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid command operation code Raw sense data (in hex):

        70 00 05 00 00 00 00 0a  00 00 00 00 20 00 00 00
        00 00

plus...: Driver_status=0x08 [DRIVER_SENSE, SUGGEST_OK]

So it doesn't support the SCSI START STOP UNIT command. Hence sdparm will be unable to spin up or down that disk :-(

Quoted 11 lines

Some info:
bash-2.05b# cat /proc/scsi/usb-storage/11
Host scsi11: usb-storage
Vendor: Prolific Technology Inc.
Product: ATAPI-6 Bridge Controller
Serial Number: 559F
Protocol: Transparent SCSI
Transport: Bulk
Quirks:

Quoted 6 lines

bash-2.05b# sdparm -lv /dev/sdc

    /dev/sdc: ST316002  3A                8.01
Quoted 4 lines
Quoted 4 lines

Read write error recovery mode page not supported Caching (SBC) mode page not supported
Control mode page not supported
Informational exception control mode page not supported

And the bridge doesn't support the normal mode pages for a disk. Seems like a minimal bridge that supports the minimal 4 commands:
- INQUIRY
- READ CAPACITY
- READ (10)
- WRITE (10)

Quoted 1 line

Not exactly "prolific".

Guess not, but that's what they call it. Marketing.. :p
How doy you tell that it's the the interface, not the disk, that has those limitations? For sure, it's a Seagate 7200.7 ATA, so I guess it should have the same features as the other interface-types of the same.. Anyways, damn!

Quoted 2 lines

I think you will find that sdparm will be more useful on your cd/dvd drive than that disk :-)

Yeah, I just don't need to spin 'em up/down ;)

As I said ealier, I'll keep looking; just got back in the saddle. I cc'd to linux-scsi, in case someone has interesting input.

Signature · 11 lines
Kind regards,
Mogens Valentin


..but the others are way beyond behind!
  -- Kim, a good friend

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw
Quoted 47 lines · Mogens Valentin
Quoted 45 lines · Douglas Gilbert
Quoted 43 lines · Mogens Valentin
Quoted 19 lines · Douglas Gilbert
Quoted 17 lines · Mogens Valentin
Quoted 8 lines · Douglas Gilbert

With sg_start (in the sg3_utils package) I have tried to spin up and down an ATA disk inside a USB enclosure without success. The same command on a USB connected CD/DVD combo drive did work.

Could you try sg_start on your USB external enclosure which I assume contains an ATA disk rather than a SCSI (SPI) disk and report if it works?

Sure. Got it, compiled, but got the error:
.../usr/include/scsi/sg.h /usr/include/scsi/scsi.h
/usr/include/stdint.h sg_lib.h sg_cmds.h llseek.h
gcc: cannot specify -o with -c or -S and multiple compilations
make: *** [sgp_dd.o] Error 1

Quoted 7 lines
Quoted 3 lines

I could only find -o and -c in the makefiles around line 95.

Slack 9.1 / 2.6.10 from sources.

Could you try the sg3_utils-1.15.tgz beta at the top of http://www.torque.net/sg [in the news section]. Hopefully that cures the compile problem.

Nope, but it changes the error. You changed the makefile exactly as I tried it, removing '-c' in line 95. This results in missing header files compiles:

...
creating sg_dd
gcc -g -O2 -Wall -W -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -c sgp_dd.c ...
.../usr/include/stdint.h sg_lib.h sg_cmds.h llseek.h
gcc: compilation of header file requested
gcc: compilation of header file requested
...
make: *** [sgp_dd.o] Error 1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Forgot to mention I have gcc version 3.2.3, FWIW..
It's not exactly an uncommon problem; I googled a bit :p
I haven't pinpointed the problem as yet, but found comments (from compiling other apps) that it could be either a gcc versioning problem, a problem with -I or -D switches, or simply a Makefile problem.

Dear oh dear! Forgot to tell you I did:
make clean; make dep; make

Doing just make clean; make did the job. Sorry about the problems. Still, make dep ought to work :p

Doesn't change the fact that either my Prolific interface or the disk doesn't support the needed scsi modes..

Signature · 2 lines
Kind regards,
Mogens Valentin