1SG_INQ(8)                          SG3_UTILS                         SG_INQ(8)
2
3
4

NAME

6       sg_inq  -  sends a SCSI INQUIRY or ATA IDENTIFY (PACKET) DEVICE command
7       and outputs the response
8

SYNOPSIS

10       sg_inq [--ata] [--cmddt] [--descriptors] [--extended] [--help]  [--hex]
11       [--id]   [--len=LEN]  [--maxlen=LEN]  [--page=PG]  [--raw]  [--verbose]
12       [--version] [--vpd] DEVICE
13
14       sg_inq [-36] [-a] [-A]  [-b]  [-c]  [-cl]  [-d]  [-e]  [-h]  [-H]  [-i]
15       [-l=LEN]  [-m] [-M] [-o=OPCODE_PG] [-p=VPD_PG] [-P] [-r] [-s] [-v] [-V]
16       [-x] [-36] [-?] DEVICE
17

DESCRIPTION

19       This utility by default sends a  SCSI  INQUIRY  command  to  the  given
20       device  and  then  outputs  the response. All SCSI devices are meant to
21       respond to a "standard"  INQUIRY  command  with  at  least  a  36  byte
22       response  (in  SCSI  2  and higher). An INQUIRY is termed as "standard"
23       when both the EVPD and CmdDt (obsolete) bits are clear.
24
25       This utility supports two command line syntaxes, the preferred  one  is
26       shown first in the synopsis and explained in this section. A later sec‐
27       tion on the old command  line  syntax  outlines  the  second  group  of
28       options.
29
30       An  important  "non-standard" INQUIRY page is the Device Identification
31       Vital Product Data (VPD) page [0x83]. Since  SPC-3,  support  for  this
32       page  is  mandatory.  The  --id  option decodes this page. New VPD page
33       information is no longer being added to this utility. To  get  informa‐
34       tion on new VPD pages see the sg_vpd(8) or sdparm(8) utilities.
35
36       If  the  DEVICE  exists  and  the SCSI INQUIRY fails (because the SG_IO
37       ioctl is not supported) then an ATA IDENTIFY (PACKET) DEVICE is  tried.
38       If it succeeds then device identification strings are output. The --raw
39       and --hex options can be used to manipulate the output.  If  the  --ata
40       option  is  given then the SCSI INQUIRY is not performed and the DEVICE
41       is assumed to be ATA (or ATAPI).
42
43       The reference document used for interpreting an INQUIRY  is  T10/1713-D
44       Revision  11  (SPC-4, 14 May 2007) found at http://www.t10.org .  Obso‐
45       lete items in the standard INQUIRY response are displayed in  brackets.
46       The  reference document for the ATA IDENTIFY (PACKET) DEVICE command is
47       ATA8-ACS found at http://www.t13.org .
48

OPTIONS

50       Arguments to long options are mandatory for short options as well.  The
51       options  are  arranged  in  alphabetical order based on the long option
52       name.
53
54       -a, --ata
55              Assume given DEVICE is an ATA or ATAPI device which can  receive
56              ATA  commands  from  the  host  operating  system. Skip the SCSI
57              INQUIRY command and use either the ATA IDENTIFY  DEVICE  command
58              (for  nonpacket  devices) or the ATA IDENTIFY PACKET DEVICE com‐
59              mand. To show the response in hex,  add  a  '--verbose'  option.
60              This option is only available in Linux.
61
62       -c, --cmddt
63              set the Command Support Data (CmdDt) bit (defaults to clear(0)).
64              Used in conjunction with the --page=PG option where PG specifies
65              the  SCSI  command opcode to query. When used twice (e.g. '-cc')
66              this utility forms a list by looping over all 256 opcodes (0  to
67              255  inclusive)  only  outputting a line for found commands. The
68              CmdDt bit is now obsolete.  It has been replaced by  the  REPORT
69              SUPPORTED  OPERATION  CODES command, see the sg_opcodes(8) util‐
70              ity.
71
72       -d, --descriptors
73              decodes and prints the version descriptors found in  a  standard
74              INQUIRY response. There are up to 8 of them. Version descriptors
75              indicate which versions of standards and/or  drafts  the  DEVICE
76              complies  with.  The normal components of a standard INQUIRY are
77              output (typically from the first 36 bytes of the response)  fol‐
78              lowed by the version descriptors if any.
79
80       -e     see entry below for --vpd.
81
82       -E, -x, --extended
83              prints the extended INQUIRY VPD page [0x86].
84
85       -h, --help
86              print  out  the  usage message then exit. When used twice, after
87              the usage message, there is a list  of  available  abbreviations
88              than can be given to the --page=PG option.
89
90       -H, --hex
91              rather  than  decode  a standard INQUIRY response, a VPD page or
92              command support data; print out the response in hex  to  stdout.
93              Error messages and warnings are typically output to stderr. When
94              used twice with the ATA Information VPD page [0x89] decodes  the
95              start  of  the  response  then  output the ATA IDENTIFY (PACKET)
96              DEVICE response in hexadecimal bytes (not 16  bit  words).  When
97              used three times with the ATA Information VPD page [0x89] or the
98              --ata option, this utility outputs  the  ATA  IDENTIFY  (PACKET)
99              DEVICE  response  in  hexadecimal  words  suitable  for input to
100              'hdparm --Istdin'.  See note below.
101
102       -i, --id
103              prints the device identification VPD page [0x83].
104
105       -l, --len=LEN
106              the number LEN is the "allocation length" field in  the  INQUIRY
107              cdb.  This is the (maximum) length of the response to be sent by
108              the device.  The default value of LEN is 0 which is  interpreted
109              as:  first  request  is  for  36  bytes and if necessary execute
110              another INQUIRY if the "additional length" field in the response
111              indicates  that  more  than  36  bytes  is available.  If LEN is
112              greater than 0 then only one INQUIRY command is performed.   See
113              paragraph below about "36 byte INQUIRYs".
114
115       -m, --maxlen=LEN
116              this  option has the same action as the --len=LEN option. It has
117              been added for  compatibility  with  the  sg_vpd,  sg_modes  and
118              sg_logs utilities.
119
120       -O, --old
121              switch to older style options.
122
123       -p, --page=PG
124              the  PG argument can be either a number of an abbreviation for a
125              VPD page. To enumerate the available abbreviations for VPD pages
126              use  '-hh'  or  a bad abbreviation (e.g, '--page=xxx'). When the
127              --cmddt option is given (once) then  PG  is  interpreted  as  an
128              opcode number (so VPD page abbreviations make little sense).
129
130       -r, --raw
131              output  the  response  in  binary  to stdout. Error messages and
132              warnings, if any, are sent to stderr.
133
134       -v, --verbose
135              increase level of verbosity. Can be used multiple times.
136
137       -V, --version
138              print out version string then exit.
139
140       -e, --vpd
141              set the Enable  Vital  Product  Data  (EVPD)  bit  (defaults  to
142              clear(0)).  Used  in conjunction with the --page=PG option where
143              PG specifies the VPD page number to query. If the  --page=PG  is
144              not  given  then PG defaults to zero which is the "Supported VPD
145              pages" VPD page.
146

NOTES

148       Some devices with weak SCSI command set implementations  lock  up  when
149       they  receive  commands they don't understand (or even response lengths
150       that they don't expect). Such devices need to be treated carefully, use
151       the  '--len=36'  option. Without this option this utility will issue an
152       initial standard INQUIRY requesting 36 bytes of response data.  If  the
153       device indicates it could have supplied more data then a second INQUIRY
154       is issued to fetch the longer response. That second command may lock up
155       faulty devices.
156
157       ATA  or ATAPI devices that use a SCSI to ATA Translation layer (see SAT
158       at www.t10.org) may support the ATA Information VPD page. This  returns
159       the  IDENTIFY  (PACKET)  DEVICE response amongst other things.  The ATA
160       Information VPD page can be fetched with '--page=ai'.
161
162       In the INQUIRY standard response there is a 'MultiP' flag which is  set
163       when  the  device  has  2 or more ports. Some vendors use the preceding
164       vendor specific ('VS') bit to indicate which port is being accessed  by
165       the  INQUIRY  command  (0  -> relative port 1 (port "a"), 1 -> relative
166       port 2 (port "b")). When the 'MultiP' flag is set, the preceding vendor
167       specific  bit  is  shown in parentheses. SPC-3 compliant devices should
168       use the device identification VPD page (0x83) to  show  which  port  is
169       being  used  for  access and the SCSI ports VPD page (0x88) to show all
170       available ports on the device.
171
172       In the 2.4 series of Linux kernels the DEVICE must be  a  SCSI  generic
173       (sg)  device.  In  the  2.6  series block devices (e.g. disks and ATAPI
174       DVDs) can also be specified. For example "sg_inq /dev/sda" will work in
175       the  2.6  series  kernels. From lk 2.6.6 other SCSI "char" device names
176       may be used as well (e.g. "/dev/st0m").
177

ATA DEVICES

179       There are two major types of ATA devices: non-packet devices (e.g.  ATA
180       disks)  and  packet  devices (ATAPI). The majority of ATAPI devices are
181       CD/DVD/BD drives in which the ATAPI transport carries the MMC set (i.e.
182       a  SCSI  command  set).  Further, both types of ATA devices can be con‐
183       nected to a host computer via a "SCSI" (or some other) transport.  When
184       an  ATA  disk  is controlled via a SCSI (or non-ATA) transport then two
185       approaches are commonly used: tunnelling (e.g. STP in  Serial  Attached
186       SCSI  (SAS))  or  by  emulating  a SCSI device (e.g. with a SCSI to ATA
187       translation layer, see SAT at www.t10.org ).  Even  when  the  physical
188       transport  to the host computer is ATA (especially in the case of SATA)
189       the operating system may choose to  put  a  SAT  layer  in  the  driver
190       "stack" (e.g. libata in Linux).
191
192       The  main  identifying  command  for any SCSI device is an INQUIRY. The
193       corresponding command for an ATA non-packet device is  IDENTIFY  DEVICE
194       while for an ATA packet device it is IDENTIFY PACKET DEVICE.
195
196       When  this  utility  is  invoked  for an ATAPI device (e.g. a CD/DVD/BD
197       drive with "sg_inq /dev/hdc") then a SCSI INQUIRY is sent to the device
198       and  if  it  responds  then the response to decoded and output and this
199       utility exits. To see the response for an ATA  IDENTIFY  PACKET  DEVICE
200       command add the --ata option (e.g. "sg_inq --ata /dev/hdc).
201
202       This  utility  doesn't  decode the response to an ATA IDENTIFY (PACKET)
203       DEVICE command, hdparm does a good job at that. The '-HHH'  option  has
204       been  added  for  use  with either the '--ata' or '--page=ai' option to
205       produce a format acceptable to "hdparm --Istdin".  An example:  'sg_inq
206       --ata -HHH /dev/hdc | hdparm --Istdin'. See hdparm.
207

EXIT STATUS

209       The exit status of sg_inq is 0 when it is successful. Otherwise see the
210       sg3_utils(8) man page.
211

OLDER COMMAND LINE OPTIONS

213       The options in this section were  the  only  ones  available  prior  to
214       sg3_utils  version  1.23  .  In  sg3_utils version 1.23 and later these
215       older options can be selected by either setting the  SG3_UTILS_OLD_OPTS
216       environment variable or using --old (or -O) as the first option.
217
218       -36    only requests 36 bytes of response data for an INQUIRY. Further‐
219              more even if the device indicates in its response it can  supply
220              more data, a second (longer) INQUIRY is not performed. This is a
221              paranoid setting.  Equivalent to '--len=36' in the main descrip‐
222              tion.
223
224       -a     fetch  the  ATA  Information  VPD  page  [0x89].  Equivalent  to
225              '--page=ai' in the main description. This page is defined in SAT
226              (see at www.t10.org).
227
228       -A     Assume  given  DEVICE  is an ATA or ATAPI device.  Equivalent to
229              --ata in the main description.
230
231       -b     decodes  the  Block  Limits  VPD  page  [0xb0].   Equivalent  to
232              '--page=bl'  in  the  main  description. This page is defined in
233              SBC-2 (see www.t10.org).
234
235       -c     set the Command Support Data (CmdDt) bit (defaults to clear(0)).
236              Used in
237               conjunction  with  the  -o=OPCODE_PG option to specify the SCSI
238              command opcode to query.  Equivalent  to  --cmddt  in  the  main
239              description.
240
241       -cl    lists  the  command data for all supported commands (followed by
242              the command name) by  looping  through  all  256  opcodes.  This
243              option  uses  the  CmdDt  bit  which  is  now  obsolete. See the
244              sg_opcodes(8) utility.  Equivalent to '--cmddt --cmddt'  in  the
245              main description.
246
247       -d     decodes  depending  on  context.  If  -e option is given, or any
248              option that implies -e (e.g. '-i' or '-p=80'), then this utility
249              attempts  to  decode the indicated VPD page.  Otherwise the ver‐
250              sion descriptors  (if  any)  are  listed  following  a  standard
251              INQUIRY  response.  In the version descriptors sense, equivalent
252              to --descriptors in the main description.
253
254       -e     enable (i.e. sets) the Vital Product Data (EVPD)  bit  (defaults
255              to  clear(0)).  Used in conjunction with the -p=VPD_PG option to
256              specify the VPD page to fetch. If -p=VPD_PG is  not  given  then
257              VPD page 0 (list supported VPD pages) is assumed.
258
259       -h     outputs INQUIRY response in hex rather than trying to decode it.
260              Equivalent to --hex in the main description.
261
262       -H     same action as -h.  Equivalent to --hex in the main description.
263
264       -i     decodes the Device Identification VPD page [0x83]. Equivalent to
265              --id  in  the  main description. This page is made up of several
266              "designation descriptors". If -h is given then  each  descriptor
267              header  is  decoded  and the identifier itself is output in hex.
268              To see the whole VPD 0x83 page response in hex use '-p=83 -h'.
269
270       -m     decodes the Management network addresses VPD page [0x85]. Equiv‐
271              alent to '--page=mna' in the main description.
272
273       -M     decodes  the  Mode  page  policy VPD page [0x87].  Equivalent to
274              '--page=mpp' in the main description.
275
276       -N     switch to the newer style options.
277
278       -o=OPCODE_PG
279              used in conjunction with the -e or -c option. If  neither  given
280              then the -e option assumed. When the -e option is also given (or
281              assumed) then the argument to this option is the VPD  page  num‐
282              ber.  The argument is interpreted as hexadecimal and is expected
283              to be in the range 0 to ff inclusive. Only VPD page 0 is decoded
284              and  it lists supported VPD pages and their names (if known). To
285              decode the mandatory device identification page (0x83)  use  the
286              -i  option.  A now obsolete usage is when the -c option is given
287              in which case the argument to this option is  assumed  to  be  a
288              command  opcode  number.  Recent SCSI draft standards have moved
289              this  facility  to  a  separate  command  (see   sg_opcodes(8)).
290              Defaults  to  0  so  if -e is given without this option then VPD
291              page 0 is output.
292
293       -p=VPD_PG
294              same action as -o=OPCODE_PG option  described  in  the  previous
295              entry.   Since  the opcode value with the CmdDt is now obsolete,
296              the main use of this option is to specify the VPD  page  number.
297              The argument is interpreted as hexadecimal and is expected to be
298              in the range 0 to ff inclusive.  Defaults to 0 so if -e is given
299              without this option then VPD page 0 is output.
300
301       -P     decodes  the  Unit Path Report VPD page [0xc0] which is EMC spe‐
302              cific.  Equivalent to '--page=upr' in the main description.
303
304       -r     outputs the response in binary to stdout.  Equivalent  to  --raw
305              in  the  main  description.   Can be used twice (i.e. '-rr' (and
306              '-HHH' has same effect)) and if used with the -A  or  -a  option
307              yields output with the same format as "cat /proc/ide/hd<x>/iden‐
308              tify" so that it can then be piped to "hdparm --Istdin".
309
310       -s     decodes  the  SCSI  Ports  VPD  page  [0x88].    Equivalent   to
311              '--page=sp' in the main description.
312
313       -v     increase level of verbosity. Can be used multiple times.
314
315       -V     print out version string then exit.
316
317       -x     decodes  the  Extended INQUIRY data VPD [0x86] page.  Equivalent
318              to '--page=ei' in the main description.
319
320       -?     output usage message and exit. Ignore all other parameters.
321

AUTHOR

323       Written by Doug Gilbert
324

REPORTING BUGS

326       Report bugs to <dgilbert at interlog dot com>.
327
329       Copyright © 2001-2010 Douglas Gilbert
330       This software is distributed under the GPL version 2. There is NO  war‐
331       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
332       POSE.
333

SEE ALSO

335       sg_opcodes(8), sg_vpd(8), sdparm(8), hdparm(8), sgdiag(scsirastools)
336
337
338
339sg3_utils-1.29                   February 2010                       SG_INQ(8)
Impressum