blob: 14c2409666b273bf3c714fe96dac69ce6da4aecd [file] [log] [blame]
.TH SG_INQ "8" "March 2005" "sg3_utils-1.14" SG3_UTILS
.SH NAME
sg_inq \- outputs data retrieved from the SCSI INQUIRY command
.SH SYNOPSIS
.B sg_inq
[\fI-c\fR] [\fI-cl\fR] [\fI-d\fR] [\fI-e\fR] [\fI-h\fR] [\fI-i\fR]
[\fI-o=<opcode_page>\fR] [\fI-p=<vpd_page>\fR] [\fI-P\fR]
[\fI-r\fR] [\fI-s\fR] [\fI-v\fR] [\fI-V\fR] [\fI-x\fR] [\fI-36\fR] [\fI-?\fR]
\fI<scsi_device>\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
This utility sends an INQUIRY SCSI command to the given device and then
outputs the response. All SCSI devices are meant to respond to
a "standard" INQUIRY command with at least a 36 byte response (in SCSI 2
and higher). An INQUIRY is termed as "standard" when both the EVPD and
CmdDt bits are clear.
.PP
An important "non-standard" INQUIRY page is the Device Identification
Vital Prodoct Data (VPD) page (page number: 0x83). In recent SPC-3
drafts support for this page has been flagged as mandatory. The '-i'
option decodes this page.
.PP
If <scsi_device> exists and the SCSI INQUIRY fails (because the SG_IO
ioctl is unknown) then an ATA IDENTIFY is tried. If it succeeds then
device identification strings are output. If the "-r" option is given
then the 256 byte IDENTIFY block is output in binary.
.PP
The reference document used for interpreting an INQUIRY is T10/1416-D Revision
21d (SPC-3, 14th February 2005) found at http://www.t10.org . Obsolete items
in the standard INQUIRY response are displayed in brackets.
.TP
-c
set the Command Support Data (CmdDt) bit (defaults to clear(0)). Used
in conjunction with the '-o=<opcode>' option to specify the SCSI command
opcode to supply the support data for. The command support data is a mask of
the same length as the command with bits set in positions that are
modifiable. For example, '12 03 ff 00 ff 01' shows the device
supports the EVPD and CmdDt bits [byte 1, bits 0 and 1] in an INQUIRY command.
The CmdDt bit is now obsolete. It has been replaced by the REPORT SUPPORTED
OPERATION CODES command which is accessed via the sg_opcodes utility.
.TP
-cl
lists the command data for all supported commands (followed by the command
name) by looping through all 256 opcodes. This option uses the CmdDt bit
which is now obsolete. See the sg_opcodes utility.
.TP
-d
lists version descriptors. There are up to 8 version descriptors in the
upper bytes of a standard INQUIRY, If the code is recognised then the
corresponding string is output. Version descriptors are versions of
standards and drafts that the device claims to comply with (e.g. SAM,
SPC, SBC, SAS etc).
.TP
-e
enable (i.e. sets) the Vital Product Data (EVPD) bit (defaults to clear(0)).
Used in conjunction with the '-p=<vpd_page>' option to specify the VPD page
to fetch. If '-p' is not given then VPD page 0 (list supported VPD pages)
is assumed. Support for VPD page 0 and page 0x83 (device identification)
have been made mandatory in recent SPC-3 drafts.
.TP
-h
outputs INQUIRY response in hex rather than trying to decode it. When
used with '-i' outputs partially decoded device identification descriptors
with the identifier itself output in hex.
.TP
-H
same action as "-h". For compatibility with many other sg3_utils programs
in which "-H" is for hex output.
.TP
-i
outputs the Device Identification Vital Product Data (VPD) page [0x83].
If '-r' is not given then attempts to decode the response which can be made
up of several "identification descriptors". If '-h' is given then each
descriptor header is decoded and the identifier itself is output in hex.
To see the whole VPD 0x83 page response in hex use '-p=83 -h'. Recent SPC-3
drafts have made support of the device identification VPD page mandatory.
.TP
-o=<opcode_page>
used in conjunction with the '-e' or '-c' option. If neither given then
the '-e' option assumed. When the '-e' option is also given (or assumed)
then the argument to this option is the VPD page number. The argument
is interpreted as hexadecimal and is expected to be in the range 0 to ff
inclusive. Only VPD page 0 is decoded and lists supported VPD pages and
their names (if known). To decode the mandatory device identification
page (0x83) use the '-i' option.
A now obsolete usage is when the '-c' option is given in which
case the argument to this option is assumed to be a command opcode number.
Recent SCSI draft standards have moved this facility (see sg_opcodes).
Defaults to 0 so if '-e' is given without '-o=' then VPD page 0 is output.
.TP
-p=<vpd_page>
same action as '-o=<opcode_page>' option described above. Since the
opcode value with the CmdDt is now obsolete, the main use of this
option is to specify the VPD page number. The argument is interpreted as
hexadecimal and is expected to be in the range 0 to ff inclusive.
Defaults to 0 so if '-e' is given without '-p=' then VPD page 0 is output.
.TP
-P
outputs the Unit Path Report Vital Product Data (VPD) page [0xc0],
which is specific to selected EMC devices. To see the whole VPD 0xc0
page response in hex use '-o=c0 -h'.
.TP
-r
outputs the INQUIRY response in binary. If the SCSI INQUIRY has failed
and an ATA IDENTIFY succeeds then the 256 byte IDENTIFY response is
output in hex. Standard output should be redirected
to a file or some other program that can process binary data.
.TP
-s
outputs the SCSI Ports Vital Product Data (VPD) page [0x88].
If '-r' is not given then attempts to decode the response. The response
contains information about the target (or rarely the initiator) ports
associated with the addressed device server (i.e. the target). In practice
this is a way to find all target port addresses of a dual ported disk.
If '-h' is given then each target (and/or initiator) descriptor is output
in hex. To see the whole VPD 0x88 page response in hex use '-p=88 -h'.
.TP
-v
verbose: print out cdb of issued commands prior to execution. '-vv'
and '-vvv' are also accepted yielding greater verbosity.
.TP
-V
print out version string
.TP
-i
outputs the Extended INQUIRY Vital Product Data (VPD) [0x86] page.
If '-r' is not given then attempts to decode the response.
If '-h' is given then prints out VPD page in hex which is similar to
using '-p=86 -h'.
.TP
-36
only requires 36 bytes of response data for an INQUIRY. Furthermore even
if the device indicates in its response it can supply more data, a
second (longer) INQUIRY is not performed.
.TP
-?
output usage message and exit. Ignore all other parameters.
.PP
Some device with weak SCSI command set implementations lock up when
they receive commands they don't understand (or even response lengths
that they don't expect). Such devices need to be treated carefully
hence the '-36' option. Without this option this utility will issue
a standard INQUIRY requesting 36 bytes of response data. If the device
indicates it could have supplied more data then a second INQUIRY is
issued to fetch the longer response.
.PP
In the INQUIRY standard response there is a 'MultiP' flag which is set
when the device has 2 or more ports. Some vendors use the preceding
vendor specific ('VS') bit to indicate which port is being accessed by
the INQUIRY command (0 -> relative port 1 (port "a"), 1 -> relative
port 2 (port "b")). When the 'MultiP' flag is set, the preceding vendor
specific bit is shown in parentheses. SPC-3 compliant devices should
use the device identification VPD page (0x83) to show which port is
being used for access and the SCSI ports VPD page (0x88) to show all
available ports on the device.
.PP
In the 2.4 series of Linux kernels the given device must be
a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
and SCSI DVDs) can also be specified. For example "sg_inq /dev/sda"
will work in the 2.6 series kernels. From lk 2.6.6 other SCSI "char"
device names may be used as well (e.g. "/dev/st0m").
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2001-2005 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B sgdiag(scsirastools), sg_opcodes(sg3_utils), sg_modes(sg3_utils),
.B sg_logs(sg3_utils), blktool(internet)