2005-05-06 13:28:57

by Douglas Gilbert

[permalink] [raw]
Subject: [Announce] sg3_utils-1.14 available

sg3_utils is a package of command line utilities for sending
SCSI commands to devices. This package targets the lk 2.6 and
lk 2.4 series. In the lk 2.6 series these utilities (except
sgp_dd) can be used with any devices that support the SG_IO
ioctl.

This version adds sg_rmsn to read media serial number(s).
The tarball contains a spec file for building rpms. That
spec file builds two binary rpms: sg3_utils and libsgutils.
In the future my plan is to make other utilities such as
sdparm depend on libsgutils. See CHANGELOG for other changes.

A tarball, rpm and deb can be found on (see table 2):
http://www.torque.net/sg
For an overview of sg3_utils see this page:
http://www.torque.net/sg/u_index.html
The sg_dd utility has its own page at:
http://www.torque.net/sg/sg_dd.html
A changelog can be found at:
http://www.torque.net/sg/p/sg3_utils.CHANGELOG

A release announcement has been sent to freshmeat.net .

Doug Gilbert


2005-05-06 14:29:30

by Drew Winstel

[permalink] [raw]
Subject: RE: [Announce] sg3_utils-1.14 available

Hello,

>This version adds sg_rmsn to read media serial number(s).

It appears that this doesn't quite work as I had hoped.

Ideally, should it not work upon every drive in which sq_inq reads the serial
number?

SUSE 9.2, vendor kernel:
root@emitestmachine 09:22:57 ~ # gcc -v; echo "----------------------"; sg_inq \
-v /dev/sg0; echo "-------------------------"; sg_rmsn -v /dev/sg0
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.4/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr \
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man\
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib \
--enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib \
--with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.4 (pre 3.3.5 20040809)
----------------------
inquiry cdb: 12 00 00 00 24 00
standard INQUIRY:
inquiry cdb: 12 00 00 00 60 00
PQual=0 Device_type=0 RMB=0 version=0x03 [SPC]
[AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=2
SCCS=0 ACC=0 TGPS=0 3PC=0 Protect=0 BQue=0
EncServ=0 MultiP=0 MChngr=0 [ACKREQQ=0] Addr16=0
[RelAdr=0] WBus16=1 Sync=1 Linked=1 [TranDis=1] CmdQue=1
Clocking=0x3 QAS=0 IUS=0
length=96 (0x60) Peripheral device type: disk
Vendor identification: QUANTUM
Product identification: ATLAS_V_36_WLS
Product revision level: 0230
inquiry cdb: 12 01 00 00 fc 00
inquiry: resid=240
inquiry cdb: 12 01 80 00 fc 00
inquiry: resid=236
Unit serial number: 143110652885
-------------------------
read media serial number cdb: ab 01 00 00 00 00 00 00 00 04 00 00
Read Media Serial Number command not supported

Using RHEL3, vanilla 2.6.7 kernel:
[root@localhost root]# gcc -v; for drive in sg0 sg1 sg2; do sg_inq -v /dev/sg2;\
echo "---- begin rmsn on sg2 ----" ; sg_rmsn -v /dev/sg2; echo "---- end rmsn \
on sg2 ----"; done
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man \
--infodir=/usr/share/info --enable-shared --enable-threads=posix \
--disable-checking --with-system-zlib --enable-__cxa_atexit \
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)
inquiry cdb: 12 00 00 00 24 00
standard INQUIRY:
inquiry cdb: 12 00 00 00 90 00
PQual=0 Device_type=0 RMB=0 version=0x03 [SPC]
[AERC=0] [TrmTsk=0] NormACA=0 HiSUP=1 Resp_data_format=2
SCCS=0 ACC=0 TGPS=0 3PC=0 Protect=0 BQue=0
EncServ=0 MultiP=0 MChngr=0 [ACKREQQ=0] Addr16=1
[RelAdr=0] WBus16=1 Sync=1 Linked=1 [TranDis=1] CmdQue=1
Clocking=0x3 QAS=1 IUS=1
length=144 (0x90) Peripheral device type: disk
Vendor identification: SEAGATE
Product identification: ST973401LC
Product revision level: F402
inquiry cdb: 12 01 00 00 fc 00
inquiry: resid=239
inquiry cdb: 12 01 80 00 fc 00
inquiry: resid=228
Unit serial number: 3LB00XQ900008443EEU1
---- begin rmsn on sg0 ----
read media serial number cdb: ab 01 00 00 00 00 00 00 00 04 00 00
Read Media Serial Number command not supported
---- end rmsn on sg0 ----
inquiry cdb: 12 00 00 00 24 00
standard INQUIRY:
PQual=0 Device_type=5 RMB=1 version=0x02 [SCSI-2]
[AERC=0] [TrmTsk=0] NormACA=1 HiSUP=1 Resp_data_format=2
SCCS=0 ACC=0 TGPS=0 3PC=0 Protect=0 BQue=0
EncServ=0 MultiP=0 MChngr=0 [ACKREQQ=0] Addr16=0
[RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=0
length=36 (0x24) Peripheral device type: cd/dvd
Vendor identification: SONY
Product identification: DVD-ROM DDU1621
Product revision level: S4.0
inquiry cdb: 12 01 00 00 fc 00
Inquiry error, VPD page=0x0: SCSI status: Check Condition
Fixed format, current; Sense key: Illegal Request
Additional sense: Invalid field in cdb
Raw sense data (in hex):
70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00
00 00
plus...: Driver_status=0x08 [DRIVER_SENSE, SUGGEST_OK]
---- begin rmsn on sg1 ----
read media serial number cdb: ab 01 00 00 00 00 00 00 00 04 00 00
Read Media Serial Number command not supported
---- end rmsn on sg1 ----
inquiry cdb: 12 00 00 00 24 00
standard INQUIRY:
inquiry cdb: 12 00 00 00 61 00
PQual=0 Device_type=0 RMB=0 version=0x05 [SPC-3]
[AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=2
SCCS=0 ACC=0 TGPS=0 3PC=0 Protect=0 BQue=0
EncServ=0 MultiP=0 MChngr=0 [ACKREQQ=0] Addr16=0
[RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=0
Clocking=0x0 QAS=0 IUS=0
length=97 (0x61) Peripheral device type: disk
Vendor identification: ATA
Product identification: FUJITSU MHT2080B
Product revision level: 0000
inquiry cdb: 12 01 00 00 fc 00
inquiry cdb: 12 01 80 00 fc 00
Unit serial number: NR00T45254L5
---- begin rmsn on sg2 ----
read media serial number cdb: ab 01 00 00 00 00 00 00 00 04 00 00
Read Media Serial Number command not supported

If I'm misunderstanding something, please let me know.

Thanks,

Drew

2005-05-07 00:53:25

by Douglas Gilbert

[permalink] [raw]
Subject: Re: [Announce] sg3_utils-1.14 available

Drew Winstel wrote:
> Hello,
>
>
>>This version adds sg_rmsn to read media serial number(s).
>
>
> It appears that this doesn't quite work as I had hoped.
>
> Ideally, should it not work upon every drive in which sq_inq reads the serial
> number?

Drew,
No. sg_rmsn issues a READ MEDIA SERIAL NUMBER SCSI command.
This command (opcode 0xab, service action 1) was added in
SPC-3 revision 11 (12th February 2003) and is not marked as
mandatory. If supported, this command yields a "free format"
media serial number. I have not seen any SCSI device that
supports it (but being in SPC-3 all device types, especially
those with removable media, could support it).

On the other hand the SCSI INQUIRY command is mandatory for
all SCSI devices. Further, recent SPC-3 drafts have made
support for the Device Identification VPD page (0x83)
mandatory. The information in the Device Identification
VPD page is much more structured, supporting multiple
descriptors that indicate _what_ is being identified:
- target port, or
- target device, or
- logical unit
with various types of identifiers supported:
- EUI-64 based
- naa
- SCSI name string (UTF-8 strings used by iSCSI)
- T10 identifiers
- vendor

For devices with non removable media, the logical unit
identifier could be viewed as a media serial number.
There seems to be a move away from free format, vendor
specific serial numbers (as provided by the Unit
Serial Number VPD page (0x80)).


Looking for other SCSI command standards that mention
"media serial number" doesn't turn up much. MMC-4
has its "features and profiles", one of which is the
media serial number feature (0x109). These can viewed
with the sg_get_config utility in sg3_utils.

I have updated the sg_rmsn man page to reflect some of
the information above.

Doug Gilbert

2005-05-09 13:01:12

by Drew Winstel

[permalink] [raw]
Subject: RE: [Announce] sg3_utils-1.14 available

Doug,
> No. sg_rmsn issues a READ MEDIA SERIAL NUMBER SCSI command.
> This command (opcode 0xab, service action 1) was added in
> SPC-3 revision 11 (12th February 2003) and is not marked as
> mandatory. If supported, this command yields a "free format"
> media serial number. I have not seen any SCSI device that
> supports it (but being in SPC-3 all device types, especially
> those with removable media, could support it).

Ahh... Note to self: ingest caffeine, THEN read mailing list!

Thanks for the information.

Drew