563 lines
26 KiB
Groff
563 lines
26 KiB
Groff
.TH SG_INQ "8" "August 2022" "sg3_utils\-1.48" SG3_UTILS
|
|
.SH NAME
|
|
sg_inq \- issue SCSI INQUIRY command and/or decode its response
|
|
.SH SYNOPSIS
|
|
.B sg_inq
|
|
[\fI\-\-ata\fR] [\fI\-\-block=0|1\fR] [\fI\-\-cmddt\fR]
|
|
[\fI\-\-descriptors\fR] [\fI\-\-export\fR] [\fI\-\-extended\fR]
|
|
[\fI\-\-force\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-id\fR]
|
|
[\fI\-\-inhex=FN\fR] [\fI\-\-json[=JO]\fR] [\fI\-\-len=LEN\fR]
|
|
[\fI\-\-long\fR] [\fI\-\-maxlen=LEN\fR] [\fI\-\-only\fR] [\fI\-\-page=PG\fR]
|
|
[\fI\-\-raw\fR] [\fI\-\-vendor\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
|
|
[\fI\-\-vpd\fR] \fIDEVICE\fR
|
|
.PP
|
|
.B sg_inq
|
|
[\fI\-36\fR] [\fI\-a\fR] [\fI\-A\fR] [\fI\-b\fR] [\fI\-\-B=0|1\fR]
|
|
[\fI\-c\fR] [\fI\-cl\fR] [\fI\-d\fR] [\fI\-e\fR] [\fI\-f\fR] [\fI\-h\fR]
|
|
[\fI\-H\fR] [\fI\-i\fR] [\fI\-I=FN\fR] [\fI\-j[=LEN]\fR] [\fI\-l=LEN\fR]
|
|
[\fI\-L\fR] [\fI\-m\fR] [\fI\-M\fR] [\fI\-o\fR] [\fI\-p=VPD_PG\fR]
|
|
[\fI\-P\fR] [\fI\-r\fR] [\fI\-s\fR] [\fI\-u\fR] [\fI\-v\fR]
|
|
[\fI\-V\fR] [\fI\-x\fR] [\fI\-36\fR] [\fI\-?\fR] \fIDEVICE\fR
|
|
.SH DESCRIPTION
|
|
.\" Add any additional description here
|
|
.PP
|
|
This utility, when \fIDEVICE\fR is given, sends a SCSI INQUIRY command to it
|
|
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 (now
|
|
obsolete) bits are clear. Formally (i.e. as per SPC stardards) the name of
|
|
a standard INQUIRY response is the "standard INQUIRY data format" but here
|
|
the "standard INQUIRY response" is used as it is shorter and more descriptive.
|
|
.PP
|
|
Alternatively the \fI\-\-inhex=FN\fR option can be given. In this case
|
|
\fIFN\fR is assumed to be a file name ('\-' for stdin) containing ASCII
|
|
hexadecimal representing an INQUIRY response.
|
|
.PP
|
|
This utility supports two command line syntaxes. The preferred one is shown
|
|
first in the synopsis and is described in the main OPTIONS section. A later
|
|
section titled OLDER COMMAND LINE OPTIONS describes the second group of
|
|
options.
|
|
.PP
|
|
An important "non\-standard" INQUIRY page is the Device Identification
|
|
Vital Product Data (VPD) page [0x83]. Since SPC\-3, support for this page
|
|
is mandatory. The \fI\-\-id\fR option decodes this page. New VPD page
|
|
information is no longer being added to this utility. The sg_vpd(8) utility
|
|
is specialized for decoding VPD pages and shares code with this utility for
|
|
that purpose. The sdparm(8) utility which is in a package of that name also
|
|
decodes VPD pages although its major purpose is to access and modify SCSI
|
|
mode pages.
|
|
.PP
|
|
In Linux, if the \fIDEVICE\fR exists and the SCSI INQUIRY fails (e.g. because
|
|
the SG_IO ioctl is not supported) then an ATA IDENTIFY (PACKET) DEVICE is
|
|
tried. If it succeeds then device identification strings are output. The
|
|
\fI\-\-raw\fR and \fI\-\-hex\fR options can be used to manipulate the output.
|
|
If the \fI\-\-ata\fR option is given then the SCSI INQUIRY is not performed
|
|
and the \fIDEVICE\fR is assumed to be ATA (or ATAPI). For more information
|
|
see the ATA DEVICES section below.
|
|
.PP
|
|
In some operating systems a NVMe device (e.g. SSD) may be given as the
|
|
\fIDEVICE\fR. For more information see the NVME DEVICES section below.
|
|
.PP
|
|
The reference document used for interpreting an INQUIRY is T10/BSR INCITS
|
|
566 Revision 6 which is draft SPC\-6 dated 22 October 2021. It can be found
|
|
at https://www.t10.org . Obsolete and reserved items in the standard
|
|
INQUIRY response output are displayed in square brackets.
|
|
.SH OPTIONS
|
|
Arguments to long options are mandatory for short options as well.
|
|
The options are arranged in alphabetical order based on the long
|
|
option name.
|
|
.TP
|
|
\fB\-a\fR, \fB\-\-ata\fR
|
|
Assume given \fIDEVICE\fR is an ATA or ATAPI device which can receive ATA
|
|
commands from the host operating system. Skip the SCSI INQUIRY command and
|
|
use either the ATA IDENTIFY DEVICE command (for non\-packet devices) or the
|
|
ATA IDENTIFY PACKET DEVICE command. To show the response in hex, add
|
|
a '\-\-verbose' option. This option is only available in Linux.
|
|
.TP
|
|
\fB\-B\fR, \fB\-\-block\fR=\fI0|1\fR
|
|
this option controls how the file handle to the \fIDEVICE\fR is opened. If
|
|
this argument is 0 then the open is non\-blocking. If the argument is 1 then
|
|
the open is blocking. In Unix a non\-blocking open is indicated by a
|
|
O_NONBLOCK flag while a blocking open is indicated by the absence of that
|
|
flag. The default value depends on the operating system and the type of
|
|
\fIDEVICE\fR node. For Linux pass\-throughs (i.e. the sg and bsg drivers)
|
|
the default is 0.
|
|
.TP
|
|
\fB\-c\fR, \fB\-\-cmddt\fR
|
|
set the Command Support Data (CmdDt) bit (defaults to clear(0)). Used in
|
|
conjunction with the \fI\-\-page=PG\fR option where \fIPG\fR specifies the
|
|
SCSI command opcode to query. When used twice (e.g. '\-cc') this utility
|
|
forms a list by looping over all 256 opcodes (0 to 255 inclusive) only
|
|
outputting a line for commands that are found. The CmdDt bit is now
|
|
obsolete; it has been replaced by the REPORT SUPPORTED OPERATION CODES
|
|
command, see the sg_opcodes(8) utility.
|
|
.TP
|
|
\fB\-d\fR, \fB\-\-descriptors\fR
|
|
decodes and prints the version descriptors found in a standard INQUIRY
|
|
response. There are up to 8 of them. Version descriptors indicate which
|
|
versions of standards and/or drafts the \fIDEVICE\fR complies with. The
|
|
normal components of a standard INQUIRY are output (typically from
|
|
the first 36 bytes of the response) followed by the version descriptors
|
|
if any.
|
|
.TP
|
|
\fB\-e\fR
|
|
see entry below for \fI\-\-vpd\fR.
|
|
.TP
|
|
\fB\-f\fR, \fB\-\-force\fR
|
|
As a sanity check, the normal action when fetching VPD pages other than
|
|
page 0x0 (the "Supported VPD pages" VPD page), is to first fetch page 0x0
|
|
and only if the requested page is one of the supported pages, to go ahead
|
|
and fetch the requested page.
|
|
.br
|
|
When this option is given, skip checking of VPD page 0x0 before accessing
|
|
the requested VPD page. The prior check of VPD page 0x0 is known to
|
|
crash certain USB devices, so use with care.
|
|
.TP
|
|
\fB\-u\fR, \fB\-\-export\fR
|
|
prints out information obtained from the device. The output can be
|
|
modified by selecting a VPD page with \fIPG\fR (from
|
|
\fI\-\-page=PG\fR). If the device identification VPD page 0x83 is
|
|
given it prints out information in the form:
|
|
"SCSI_IDENT_<assoc>_<type>=<ident>" to stdout. If the device serial
|
|
number VPD page 0x80 is given it prints out information in the form:
|
|
"SCSI_SERIAL=<ident>". Other VPD pages are not supported. If no VPD
|
|
page is given it prints out information in the form:
|
|
"SCSI_VENDOR=<vendor>", "SCSI_MODEL=<model>", and
|
|
"SCSI_REVISION=<rev>", taken from the standard inquiry. This may be
|
|
useful for tools like udev(7) in Linux.
|
|
.TP
|
|
\fB\-E\fR, \fB\-x\fR, \fB\-\-extended\fR
|
|
prints the extended INQUIRY VPD page [0x86]. It has the same effect
|
|
as giving the \fI\-\-page=ei\fR option.
|
|
.TP
|
|
\fB\-h\fR, \fB\-\-help\fR
|
|
print out the usage message then exit. When used twice, after the
|
|
usage message, there is a list of available abbreviations than can be
|
|
given to the \fI\-\-page=PG\fR option.
|
|
.TP
|
|
\fB\-H\fR, \fB\-\-hex\fR
|
|
rather than decode a standard INQUIRY response, a VPD page or command
|
|
support data; print out the response in hex and send the output to stdout.
|
|
Error messages and warnings are typically output to stderr. When used twice
|
|
with the ATA Information VPD page [0x89] decodes the start of the response
|
|
then outputs the ATA IDENTIFY (PACKET) DEVICE response in hexadecimal
|
|
bytes (not 16 bit words). When used three times with the ATA Information VPD
|
|
page [0x89] or the \fI\-\-ata\fR option, this utility outputs the ATA
|
|
IDENTIFY (PACKET) DEVICE response in hexadecimal words suitable for input
|
|
to 'hdparm \-\-Istdin'. See note below.
|
|
.br
|
|
To generate output suitable for placing in a file that can be used by a
|
|
later invocation with the \fI\-\-inhex=FN\fR option, use the '\-HHHH'
|
|
option (e.g. 'sg_inq \-p di \-HHHH /dev/sg3 > dev_id.hex').
|
|
.TP
|
|
\fB\-i\fR, \fB\-\-id\fR
|
|
prints the device identification VPD page [0x83]. It has the same effect
|
|
as giving the \fI\-\-page=di\fR option.
|
|
.TP
|
|
\fB\-I\fR, \fB\-\-inhex\fR=\fIFN\fR
|
|
\fIFN\fR is expected to be a file name (or '\-' for stdin) which contains
|
|
ASCII hexadecimal or binary representing an INQUIRY (including VPD page)
|
|
response. This utility will then decode that response. It is preferable to
|
|
also supply the \fI\-\-page=PG\fR option, if not this utility will attempt
|
|
to guess which VPD page (or standard INQUIRY) that the response is associated
|
|
with. The hexadecimal should be arranged as 1 or 2 digits representing a
|
|
byte each of which is whitespace or comma separated. Anything from and
|
|
including a hash mark to the end of a line is ignored. If the \fI\-\-raw\fR
|
|
option is also given then \fIFN\fR is treated as binary.
|
|
.TP
|
|
\fB\-j\fR, \fB\-\-json[\fR=\fIJO\fR]
|
|
output is in JSON format instead of human readable form. See sg3_utils_json
|
|
manpage or use '?' for \fIJO\fR for a summary.
|
|
.TP
|
|
\fB\-l\fR, \fB\-\-len\fR=\fILEN\fR
|
|
the number \fILEN\fR is the "allocation length" field in the INQUIRY cdb.
|
|
This is the (maximum) length of the response returned by the device. The
|
|
default value of \fILEN\fR is 0 which is interpreted as: first request is
|
|
for 36 bytes and if necessary execute another INQUIRY if the "additional
|
|
length" field in the response indicates that more than 36 bytes is available.
|
|
.br
|
|
If \fILEN\fR is greater than 0 then only one INQUIRY command is performed.
|
|
This means that the Serial Number (obtained from the Serial Number VPD
|
|
pgae (0x80)) is not fetched and therefore not printed.
|
|
See the NOTES section below about "36 byte INQUIRYs".
|
|
.TP
|
|
\fB\-L\fR, \fB\-\-long\fR
|
|
this option causes more information to be decoded from the Identify command
|
|
sent to a NVMe \fIDEVICE\fR.
|
|
.TP
|
|
\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
|
|
this option has the same action as the \fI\-\-len=LEN\fR option above. It has
|
|
been added for compatibility with the sg_vpd, sg_modes and sg_logs utilities.
|
|
.TP
|
|
\fB\-O\fR, \fB\-\-old\fR
|
|
Switch to older style options. Please use as first option on the command line.
|
|
.TP
|
|
\fB\-o\fR, \fB\-\-only\fR
|
|
Do not attempt to additionally retrieve the serial number VPD page (0x80) to
|
|
enhance the output of a standard INQUIRY. So with this option given and no
|
|
others, this utility will send a standard INQUIRY SCSI command and decode
|
|
its response. No other SCSI commands will be sent to the \fIDEVICE\fR.
|
|
Without this option an additional SCSI command is sent: a (non\-standard)
|
|
SCSI INQUIRY to fetch the Serial Number VPD page. However the Serial
|
|
Number VPD page is not mandatory (while the Device Identification page is
|
|
mandatory but a billion USB keys ignore that) and may cause nuisance error
|
|
reports.
|
|
.br
|
|
For NVMe devices only the Identify controller is performed, even if the
|
|
\fIDEVICE\fR includes a namespace identifier. For example in FreeBSD
|
|
given a \fIDEVICE\fR named /dev/nvme0ns1 then an Identify controller is
|
|
sent to /dev/nvme0 and nothing is sent to its "ns1" (first namespace).
|
|
.TP
|
|
\fB\-p\fR, \fB\-\-page\fR=\fIPG\fR
|
|
the \fIPG\fR argument can be either a number of an abbreviation for a VPD
|
|
page. To enumerate the available abbreviations for VPD pages use '\-hh' or
|
|
a bad abbreviation (e.g, '\-\-page=xxx'). When the \fI\-\-cmddt\fR option is
|
|
given (once) then \fIPG\fR is interpreted as an opcode number (so VPD page
|
|
abbreviations make little sense).
|
|
.br
|
|
If \fIPG\fR is a negative number, then a standard INQUIRY is performed. This
|
|
can be used to override some guessing logic associated with the
|
|
\fI\-\-inhex=FN\fR option.
|
|
.br
|
|
If \fIPG\fR is not found in the 'Supported VPD pages' VPD page (0x0) then
|
|
EDOM is returned. To bypass this check use the \fI\-\-force\fR option.
|
|
.TP
|
|
\fB\-r\fR, \fB\-\-raw\fR
|
|
in the absence of \fI\-\-inhex=FN\fR then the output response is in binary.
|
|
The output should be piped to a file or another utility when this option is
|
|
used. The binary is sent to stdout, and errors are sent to stderr.
|
|
.br
|
|
If used with \fI\-\-inhex=FN\fR then the contents of \fIFN\fR is treated as
|
|
binary.
|
|
.TP
|
|
\fB\-s\fR, \fB\-\-vendor\fR
|
|
output a standard INQUIRY response's vendor specific fields from offset 36
|
|
to 55 in ASCII. When used twice (i.e. '\-ss') also output the vendor
|
|
specific field from offset 96 in ASCII. This is only done if the data
|
|
passes some simple sanity checks.
|
|
.TP
|
|
\fB\-v\fR, \fB\-\-verbose\fR
|
|
increase level of verbosity. Can be used multiple times.
|
|
.TP
|
|
\fB\-V\fR, \fB\-\-version\fR
|
|
print out version string then exit.
|
|
.TP
|
|
\fB\-e\fR, \fB\-\-vpd\fR
|
|
set the Enable Vital Product Data (EVPD) bit (defaults to clear(0)). Used in
|
|
conjunction with the \fI\-\-page=PG\fR option where \fIPG\fR specifies the
|
|
VPD page number to query. If the \fI\-\-page=PG\fR is not given then \fIPG\fR
|
|
defaults to zero which is the "Supported VPD pages" VPD page.
|
|
.SH NOTES
|
|
Some devices with weak SCSI command set implementations lock up when they
|
|
receive commands they don't understand (and some lock up if they receive
|
|
response lengths that they don't expect). Such devices need to be treated
|
|
carefully, use the '\-\-len=36' option. Without this option this utility will
|
|
issue an initial 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. That second command may lock up
|
|
faulty devices.
|
|
.PP
|
|
ATA or ATAPI devices that use a SCSI to ATA Translation layer (see
|
|
SAT at www.t10.org) may support the SCSI ATA INFORMATION VPD page. This
|
|
returns the IDENTIFY (PACKET) DEVICE response amongst other things.
|
|
The ATA Information VPD page can be fetched with '\-\-page=ai'.
|
|
.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 \fIDEVICE\fR must be
|
|
a SCSI generic (sg) device. In the 2.6 series and later block devices (e.g.
|
|
disks and ATAPI 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").
|
|
.PP
|
|
The number of bytes output by \fI\-\-hex\fR and \fI\-\-raw\fR is 36 bytes
|
|
or the number given to \fI\-\-len=LEN\fR (or \fI\-\-maxlen=LEN\fR). That
|
|
number is reduced if the "resid" returned by the HBA indicates less bytes
|
|
were sent back from \fIDEVICE\fR.
|
|
.PP
|
|
The \fIDEVICE\fR is opened with a read\-only flag (e.g. in Unix with the
|
|
O_RDONLY flag).
|
|
.SH ATA DEVICES
|
|
There are two major types of ATA devices: non\-packet devices (e.g. ATA
|
|
disks) and packet devices (ATAPI). The majority of ATAPI devices are
|
|
CD/DVD/BD drives in which the ATAPI transport carries the MMC set (i.e.
|
|
a SCSI command set). Further, both types of ATA devices can be connected
|
|
to a host computer via a "SCSI" (or some other) transport. When an
|
|
ATA disk is controlled via a SCSI (or non\-ATA) transport then two
|
|
approaches are commonly used: tunnelling (e.g. STP in Serial Attached
|
|
SCSI (SAS)) or by emulating a SCSI device (e.g. with a SCSI to
|
|
ATA translation layer, see SAT at www.t10.org ). Even when the
|
|
physical transport to the host computer is ATA (especially in the
|
|
case of SATA) the operating system may choose to put a SAT
|
|
layer in the driver "stack" (e.g. libata in Linux).
|
|
.PP
|
|
The main identifying command for any SCSI device is an INQUIRY. The
|
|
corresponding command for an ATA non\-packet device is IDENTIFY DEVICE
|
|
while for an ATA packet device it is IDENTIFY PACKET DEVICE.
|
|
.PP
|
|
When this utility is invoked for an ATAPI device (e.g. a CD/DVD/BD
|
|
drive with "sg_inq /dev/hdc") then a SCSI INQUIRY is sent to the
|
|
device and if it responds then the response to decoded and output and
|
|
this utility exits. To see the response for an ATA IDENTIFY PACKET
|
|
DEVICE command add the \fI\-\-ata\fR option (e.g. "sg_inq \-\-ata /dev/hdc).
|
|
.PP
|
|
This utility doesn't decode the response to an ATA IDENTIFY (PACKET)
|
|
DEVICE command, hdparm does a good job at that. The '\-HHH' option has
|
|
been added for use with either the '\-\-ata' or '\-\-page=ai'
|
|
option to produce a format acceptable to "hdparm \-\-Istdin".
|
|
An example: 'sg_inq \-\-ata \-HHH /dev/hdc | hdparm \-\-Istdin'. See hdparm.
|
|
.SH NVME DEVICES
|
|
Currently these device are typically SSDs (Solid State Disks) directly
|
|
connected to a PCIe connector or via a specialized connector such as a M2
|
|
connector. Linux and FreeBSD treat NVMe storage devices as separate from
|
|
SCSI storage with device names like /dev/nvme0n1 (in Linux) and
|
|
/dev/nvme0ns1 (in FreeBSD). The NVM Express group has a document titled "NVM
|
|
Express: SCSI Translation Reference" which defines a partial "SCSI to NVMe
|
|
Translation Layer" often known by its acronym: SNTL.
|
|
.PP
|
|
On operating systems where it is supported by this package, this utility
|
|
will detect NVMe storage devices directly connected and send an Identify
|
|
controller NVMe Admin command and decode its response. A NVMe controller
|
|
is architecturally similar to a SCSI target device. If the NVMe \fIDEVICE\fR
|
|
indicates a namespace then an Identify namespace NVMe Admin command is sent
|
|
to that namespace and its response is decoded. Namespaces are numbered
|
|
sequentially starting from 1. Namespaces are similar to SCSI Logical Units
|
|
and their identifiers (nsid_s) can be thought of as SCSI LUNs. In the
|
|
Linux and FreeBSD example device names above the "n1" and the "ns1" parts
|
|
indicate nsid 1 . If no namespace is given in the \fIDEVICE\fR then all
|
|
namespaces found in the controller are sent Identify namespace commands and
|
|
the responses are decoded.
|
|
.PP
|
|
To get more details in the response use the \fI\-\-long\fR option. To only
|
|
get the controller's Identify decoded use the \fI\-\-only\fR option.
|
|
.PP
|
|
It is possible that even though the \fIDEVICE\fR presents as a NVMe device,
|
|
it has a SNTL and accepts SCSI commands. In this case to send a SCSI INQUIRY
|
|
command (and fetch its VPD pages) use the sg_vpd(8) utility.
|
|
.SH SG_INQ and SG_VPD
|
|
Both these utilities have much in common since VPD pages are fetched with the
|
|
SCSI INQUIRY command. As more VPD pages have been added (and existing pages
|
|
expanded) the newer ones were only decoded with sg_vpd. Recently with the
|
|
optional JSON output work, it was decided to place all VPD page decoding in
|
|
a source file called sg_vpd_common.c that is linked in by both sg_inq and
|
|
sg_vpd.
|
|
.PP
|
|
This means that the VPD page decoding capabilities of both sg_inq and sg_vpd
|
|
will be the same. Their default actions remain as they were, namely when
|
|
sg_inq is used without command line options, it decodes the "standard INQUIRY
|
|
data format" (usually called the "standard INQUIRY response") response while
|
|
when sg_vpd is used without options, it decodes the "Supported VPD pages" VPD
|
|
page.
|
|
.SH EXIT STATUS
|
|
The exit status of sg_inq is 0 when it is successful. Otherwise see
|
|
the sg3_utils(8) man page.
|
|
.SH OLDER COMMAND LINE OPTIONS
|
|
The options in this section were the only ones available prior to sg3_utils
|
|
version 1.23 . Since then this utility defaults to the newer command line
|
|
options which can be overridden by using \fI\-\-old\fR (or \fI\-O\fR) as the
|
|
first option. See the ENVIRONMENT VARIABLES section for another way to
|
|
force the use of these older command line options.
|
|
.TP
|
|
\fB\-36\fR
|
|
only requests 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. This is a paranoid setting.
|
|
Equivalent to '\-\-len=36' in the OPTIONS section.
|
|
.TP
|
|
\fB\-a\fR
|
|
fetch the ATA Information VPD page [0x89]. Equivalent to '\-\-page=ai' in
|
|
the OPTIONS section. This page is defined in SAT (see at www.t10.org).
|
|
.TP
|
|
\fB\-A\fR
|
|
Assume given \fIDEVICE\fR is an ATA or ATAPI device.
|
|
Equivalent to \fI\-\-ata\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-b\fR
|
|
decodes the Block Limits VPD page [0xb0]. Equivalent to '\-\-page=bl' in
|
|
the OPTIONS section. This page is defined in SBC\-2 (see www.t10.org) and
|
|
later.
|
|
.TP
|
|
\fB\-B\fR=\fI0|1\fR
|
|
equivalent to \fI\-\-block=0|1\fR in OPTIONS section.
|
|
.TP
|
|
\fB\-c\fR
|
|
set the Command Support Data (CmdDt) bit (defaults to clear(0)). Used in
|
|
conjunction with the \fI\-p=VPD_PG\fR option to specify the SCSI command
|
|
opcode to query. Equivalent to \fI\-\-cmddt\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-cl\fR
|
|
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(8) utility.
|
|
Equivalent to '\-\-cmddt \-\-cmddt' in the OPTIONS section.
|
|
.TP
|
|
\fB\-d\fR
|
|
decodes depending on context. If \fI\-e\fR option is given, or any option
|
|
that implies \fI\-e\fR (e.g. '\-i' or '\-p=80'), then this utility attempts
|
|
to decode the indicated VPD page. Otherwise the version descriptors (if any)
|
|
are listed following a standard INQUIRY response. In the version descriptors
|
|
sense, equivalent to \fI\-\-descriptors\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-e\fR
|
|
enable (i.e. sets) the Vital Product Data (EVPD) bit (defaults to clear(0)).
|
|
Used in conjunction with the \fI\-p=VPD_PG\fR option to specify the VPD page
|
|
to fetch. If \fI\-p=VPD_PG\fR is not given then VPD page 0 (list supported
|
|
VPD pages) is assumed.
|
|
.TP
|
|
\fB\-f\fR
|
|
Equivalent to \fI\-\-force\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-h\fR
|
|
outputs INQUIRY response in hex rather than trying to decode it.
|
|
Equivalent to \fI\-\-hex\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-H\fR
|
|
same action as \fI\-h\fR.
|
|
Equivalent to \fI\-\-hex\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-i\fR
|
|
decodes the Device Identification VPD page [0x83]. Equivalent to \fI\-\-id\fR
|
|
in the OPTIONS section. This page is made up of several "designation
|
|
descriptors". If \fI\-h\fR 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'.
|
|
.TP
|
|
\fB\-I\fR=\fIFN\fR
|
|
equivalent to \fI\-\-inhex=FN\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-j[\fR=\fIJO]\fR
|
|
equivalent to \fI\-\-json[=JO]\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-l\fR=\fILEN\fR
|
|
equivalent to \fI\-\-len=LEN\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-L\fR
|
|
equivalent to \fI\-\-long\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-m\fR
|
|
decodes the Management network addresses VPD page [0x85]. Equivalent
|
|
to '\-\-page=mna' in the OPTIONS section.
|
|
.TP
|
|
\fB\-M\fR
|
|
decodes the Mode page policy VPD page [0x87]. Equivalent to '\-\-page=mpp'
|
|
in the OPTIONS section.
|
|
.TP
|
|
\fB-N\fR, \fB\-\-new\fR
|
|
Switch to the newer style options.
|
|
.TP
|
|
\fB\-o\fR
|
|
equivalent to \fI\-\-only\fR in the OPTIONS section.
|
|
.TP
|
|
\fB\-p\fR=\fIVPD_PG\fR
|
|
used in conjunction with the \fI\-e\fR or \fI\-c\fR option. If neither given
|
|
then the \fI\-e\fR option assumed. When the \fI\-e\fR 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 it lists supported VPD pages
|
|
and their names (if known). To decode the mandatory device identification
|
|
page (0x83) use the \fI\-i\fR option. A now obsolete usage is when the
|
|
\fI\-c\fR 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 to a separate command (see sg_opcodes(8)). Defaults to 0 so if
|
|
\fI\-e\fR is given without this option then VPD page 0 is output.
|
|
.TP
|
|
\fB\-P\fR
|
|
decodes the Unit Path Report VPD page [0xc0] which is EMC specific.
|
|
Equivalent to '\-\-page=upr' in the OPTIONS section.
|
|
.TP
|
|
\fB\-r\fR
|
|
outputs the response in binary to stdout. Equivalent to \fI\-\-raw\fR in
|
|
the OPTIONS section. Can be used twice (i.e. '\-rr' (and '\-HHH' has
|
|
same effect)) and if used with the \fI\-A\fR or \fI\-a\fR option yields
|
|
output with the same format as "cat /proc/ide/hd<x>/identify" so that it
|
|
can then be piped to "hdparm \-\-Istdin".
|
|
.TP
|
|
\fB\-s\fR
|
|
decodes the SCSI Ports VPD page [0x88].
|
|
Equivalent to '\-\-page=sp' in the OPTIONS section.
|
|
.TP
|
|
\fB\-u\fR
|
|
equivalent to '\-\-export' in the OPTIONS section.
|
|
.TP
|
|
\fB\-v\fR
|
|
increase level of verbosity. Can be used multiple times.
|
|
.TP
|
|
\fB\-V\fR
|
|
print out version string then exit.
|
|
.TP
|
|
\fB\-x\fR
|
|
decodes the Extended INQUIRY data VPD [0x86] page.
|
|
Equivalent to '\-\-page=ei' in the OPTIONS section.
|
|
.TP
|
|
\fB\-?\fR
|
|
output usage message and exit. Ignore all other parameters.
|
|
.SH EXAMPLES
|
|
The examples in this page use Linux device names. For suitable device
|
|
names in other supported Operating Systems see the sg3_utils(8) man page.
|
|
.PP
|
|
To view the standard inquiry response use without options:
|
|
.PP
|
|
sg_inq /dev/sda
|
|
.PP
|
|
Some SCSI devices include version descriptors indicating the various
|
|
SCSI standards and drafts they support. They can be viewed with:
|
|
.PP
|
|
sg_inq \-d /dev/sda
|
|
.PP
|
|
Modern SCSI devices include Vital Product Data (VPD)pages which can be
|
|
viewed with the SCSI INQUIRY command. To list the supported VPD
|
|
pages (but not their contents) try:
|
|
.PP
|
|
sg_inq \-e /dev/sda
|
|
.PP
|
|
In Linux, binary images of some important VPD page responses (e.g. 0, 80h
|
|
and 83h) are cached in files within the sysfs pseudo file system. Since
|
|
VPD pages hardly ever change their contents, decoding those files will
|
|
give the same output as probing the device with the added benefit that
|
|
decoding those files doesn't need root permissions. If /dev/sg3 is a disk
|
|
at 2:0:0:0 , then these three invocations should result in the same output:
|
|
.PP
|
|
sg_inq \-\-raw \-\-inhex=/sys/class/scsi_generic/sg3/device/vpd_pg83
|
|
.PP
|
|
sg_inq \-rI /sys/class/scsi_generic/sg3/device/vpd_pg83
|
|
.PP
|
|
sg_inq \-r \-I /sys/class/scsi_disk/2:0:0:0/device/vpd_pg83
|
|
.PP
|
|
Without the \fI\-\-raw\fR option, the \fI\-\-inhex=FN\fR option would
|
|
expect the contents of those files to be hexadecimal. vpd_pg83 contains
|
|
the response (in binary) to the Device Identification VPD page whose page
|
|
number is 83h (i.e. hexadecimal).
|
|
.PP
|
|
Some VPD pages can be read with the sg_inq utility but a newer utility
|
|
called sg_vpd specializes in showing their contents. The sdparm utility
|
|
can also be used to show the contents of VPD pages.
|
|
.PP
|
|
Further examples of sg_inq together with some typical output can be found
|
|
on https://sg.danny.cz/sg/sg3_utils.html web page.
|
|
.SH ENVIRONMENT VARIABLES
|
|
Since sg3_utils version 1.23 the environment variable SG3_UTILS_OLD_OPTS
|
|
can be given. When it is present this utility will expect the older command
|
|
line options. So the presence of this environment variable is equivalent to
|
|
using \fI\-\-old\fR (or \fI\-O\fR) as the first command line option.
|
|
.SH AUTHOR
|
|
Written by Douglas Gilbert
|
|
.SH "REPORTING BUGS"
|
|
Report bugs to <dgilbert at interlog dot com>.
|
|
.SH COPYRIGHT
|
|
Copyright \(co 2001\-2022 Douglas Gilbert
|
|
.br
|
|
This software is distributed under the GPL version 2 or the BSD\-2\-Clause
|
|
license. There is NO warranty; not even for MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE.
|
|
.SH "SEE ALSO"
|
|
.B sg_opcodes(8), sg_vpd(8), sg_logs(8), sg_modes(8), sdparm(8), hdparm(8),
|
|
.B sgdiag(scsirastools)
|