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

NAME

6       sg_vpd - fetch SCSI VPD page and/or decode its response
7

SYNOPSIS

9       sg_vpd  [--all]  [--enumerate]  [--force]  [--help]  [--hex]  [--ident]
10       [--inhex=FN]  [--long]  [--maxlen=LEN]  [--page=PG]  [--quiet]  [--raw]
11       [--vendor=VP] [--verbose] [--version] [DEVICE]
12

DESCRIPTION

14       This  utility, when DEVICE is given, fetches a Vital Product Data (VPD)
15       page and decodes it or outputs it in ASCII hexadecimal or  binary.  VPD
16       pages are fetched with a SCSI INQUIRY command.
17
18       Alternatively  the  --inhex=FN  option can be given. In this case FN is
19       assumed to be a file name ('-' for stdin) containing ASCII  hexadecimal
20       representing  a  VPD  page  response. If the --raw option is also given
21       then binary input is assumed (rather than ASCII hexadecimal).
22
23       Probably the most important page is the Device Identification VPD  page
24       (page  number:  0x83).  Since  SPC-3,  support  for  this page has been
25       flagged as mandatory. This page can be fetched  by  using  the  --ident
26       option.
27
28       The reference document used for interpreting VPD pages (and the INQUIRY
29       standard response) is T10/BSR INCITS 502 Revision  19  which  is  draft
30       SPC-5   revision   19,   14   February   2018).  It  can  be  found  at
31       http://www.t10.org .
32
33       When no options are given, other than a DEVICE, then the "Supported VPD
34       pages" (0x0) VPD page is fetched and decoded.
35

OPTIONS

37       Arguments to long options are mandatory for short options as well.  The
38       options are arranged in alphabetical order based  on  the  long  option
39       name.
40
41       -a, --all
42              decode  all  VPD  pages.  When  used with DEVICE the pages to be
43              decoded are found in the "Supported VPD pages" VPD  page.  Pages
44              that  cannot  be  decoded  are  displayed in hex; add the --long
45              option to have ASCII displayed to the right of each line of hex.
46              If this option is used with the --inhex=FN option then the  file
47              FN  is  assumed  to contain 1 or more VPD pages (in ASCII hex or
48              binary).  Decoding continues until the file is exhausted (or  an
49              error  occurs).  Sanity  checks  are  aplied  on each VPD page's
50              length and the ascending order of VPD page numbers (required  by
51              SPC-4) so bad data may be detected.
52              If  the  --page=PG  option  is also given then no VPD page whose
53              page number is greater than PG (or its  numeric  equivalent)  is
54              decoded.
55
56       -e, --enumerate
57              list  the names of the known VPD pages, first the standard pages
58              (i.e.  those defined by T10), then the  vendor  specific  pages.
59              Each  group is sorted in abbreviation order. The DEVICE and most
60              other options are ignored and this utility exits  after  listing
61              the VPD page names. May be used together with --page=PG where PG
62              is numeric. If so, it searches for the summary lines of all  VPD
63              pages  whose  number matches PG. May be used with --vendor=VP to
64              restrict output to known vendor specific pages for  vendor/prod‐
65              uct VP.
66
67       -f, --force
68              As  a  sanity  check,  the normal action when fetching VPD pages
69              other than page 0x0 (the "Supported VPD pages" VPD page), is  to
70              first  fetch  page  0x0 and only if the requested page is one of
71              the supported pages, to go ahead and fetch the requested page.
72              When this option is given, skip checking of VPD page 0x0  before
73              accessing  the  requested  VPD page. The prior check of VPD page
74              0x0 is known to crash certain USB devices, so use with care.
75
76       -h, --help
77              outputs the usage message summarizing command line options  then
78              exits.  Ignores DEVICE if given.
79
80       -H, --hex
81              outputs the requested VPD page in ASCII hexadecimal. Can be used
82              multiple times, see section on the ATA information vpd page.
83              To generate output suitable for placing in a file  that  can  be
84              used  by  a later invocation with the --inhex=FN option, use the
85              '-HHHH'  option  (e.g.  'sg_vpd   -p   di   -HHHH   /dev/sg3   >
86              dev_id.hex').  The  reason  '-HHHH'  is  used  is  to  flag that
87              unadorned hexadecimal (without other text or address offsets) is
88              sent to stdout.
89
90       -i, --ident
91              decode the device identification (0x83) VPD page. When used once
92              this option has the same effect as '--page=di'. When  use  twice
93              then the short form of the device identification VPD page's log‐
94              ical unit designator is decoded. In the latter case this  option
95              has the same effect as '--quiet --page=di_lu'.
96
97       -I, --inhex=FN
98              FN  is  expected to be a file name (or '-' for stdin) which con‐
99              tains ASCII hexadecimal or binary representing a VPD page (or  a
100              standard  INQUIRY)  response. This utility will then decode that
101              response. It is preferable to also supply the --page=PG  option,
102              if  not  this  utility  will attempt to guess which VPD page (or
103              standard INQUIRY) the response is associated with. The hexadeci‐
104              mal should be arranged as 1 or 2 digits representing a byte each
105              of which is whitespace or comma  separated.  Anything  from  and
106              including  a  hash  mark  to  the end of line is ignored. If the
107              --raw option is also given then FN is treated as binary.
108
109       -l, --long
110              when decoding some VPD pages, give a  little  more  output.  For
111              example  the  ATA  Information VPD page only shows the signature
112              (in hex) and the IDENTIFY (PACKET) DEVICE  (in  hex)  when  this
113              option is given.
114
115       -m, --maxlen=LEN
116              where  LEN  is  the  (maximum)  response  length in bytes. It is
117              placed in the cdb's "allocation length" field. If not given  (or
118              LEN  is  zero)  then 252 is used (apart from the ATA Information
119              VPD page which defaults to 572) and, if the  response  indicates
120              this value is insufficient, another INQUIRY command is sent with
121              a larger value in the cdb's "allocation length" field.  If  this
122              option  is given and LEN is greater than 0 then only one INQUIRY
123              command is sent. Since many simple devices implement the INQUIRY
124              command  badly  (and  do  not support VPD pages) then the safest
125              value to use for LEN is 36. See the sg_inq man page for the more
126              information.
127
128       -p, --page=PG
129              where  PG  is the VPD page to be decoded or output. The PG argu‐
130              ment can either be an abbreviation, a number or a pair  or  num‐
131              bers/abbreviations  separated by a comma. The VPD page abbrevia‐
132              tions can be seen by using the --enumerate option. If  a  number
133              is given it is assumed to be decimal unless it has a hexadecimal
134              indicator which is either a leading '0x' or a trailing  'h'.  If
135              one  number is given then it is assumed to be a VPD page number.
136              If two numbers (or abbreviations) are given then the second  one
137              is  the  same as VP (see the --vendor=VP option). If this option
138              is not given (nor '-i', '-l' nor '-V') then the  "Supported  VPD
139              pages"  (0x0)  VPD page is fetched and decoded. If PG is '-1' or
140              'sinq' then the standard INQUIRY response is output. This option
141              may also be used with the --enumerate (see its description).
142              If  PG  is not found in the 'Supported VPD pages' VPD page (0x0)
143              then EDOM is returned. To bypass  this  check  use  the  --force
144              option.
145
146       -q, --quiet
147              suppress the amount of decoding output.
148
149       -r, --raw
150              if  not  used  with --inhex=FN then output requested VPD page in
151              binary.  The output should be piped to a file or another utility
152              when  this  option  is  used.  The binary is sent to stdout, and
153              errors are sent to stderr.
154              if used with --inhex=FN then the contents of FN  is  treated  as
155              binary.
156
157       -M, --vendor=VP
158              where  VP is a vendor (e.g. "sea" for Seagate) or vendor/product
159              acronym (e.g. "hp3par" for the 3PAR array from HP). Many vendors
160              have re-used the numbers at the beginning of the vendor specific
161              VPD page range (e.g.  page 0xc0) and this option  is  a  way  of
162              selecting  only those which are of interest. Using a VP of "xxx"
163              will list the available acronyms.
164              If this option is used with --page=PG and PG is an acronym  then
165              this option is ignored. If PG is a number (e.g. 0xc0) then VP is
166              used to choose the which vendor specific page (e.g. sharing page
167              number 0xc0) to decode.
168
169       -v, --verbose
170              increases the level or verbosity.
171
172       -V, --version
173              print out version string then exit.
174

ATA INFORMATION VPD PAGE

176       This  VPD page (0x89 or 'ai') is defined by the SCSI to ATA Translation
177       standard. It contains information about the SAT layer, the  "signature"
178       of  the ATA device and the response to the ATA IDENTIFY (PACKET) DEVICE
179       command. The latter part has 512 bytes of identity, capability and set‐
180       tings  data  which  the  hdparm utility is capable of decoding (so this
181       utility doesn't decode it).
182
183       To unclutter the output for this page, the signature and  the  IDENTIFY
184       (PACKET)  DEVICE  response  are not output unless the --long option (or
185       --hex or --raw) are given. When the --long option is given the IDENTIFY
186       (PACKET)  DEVICE  response  is  output  as 256 (16 bit) words as is the
187       fashion for ATA devices. To see that response as a string of bytes  use
188       the  '-HH'  option.  To format the output suitable for hdparm to decode
189       use either the '-HHH' or '-rr' option. For example if  'dev/sdb'  is  a
190       SATA  disk  behind  a  SAT  layer then this command: 'sg_vpd -p ai -HHH
191       /dev/sdb | hdparm --Istdin' should decode  the  ATA  IDENTIFY  (PACKET)
192       DEVICE response.
193

NOTES

195       Since  some  VPD  pages (e.g. the Extended INQUIRY page) depend on set‐
196       tings in the standard  INQUIRY  response,  then  the  standard  INQUIRY
197       response  is  output  as  a  pseudo  VPD page when PG is set to '-1' or
198       'sinq'. Also the decoding of some fields  (e.g.  the  Extended  INQUIRY
199       page's  SPT  field) is expanded when the '--long' option is given using
200       the standard INQUIRY response information (e.g. the PDT and the PROTECT
201       fields).
202
203       In  the  2.4  series of Linux kernels the DEVICE must be a SCSI generic
204       (sg) device. In the 2.6 series block  devices  (e.g.  disks  and  ATAPI
205       DVDs) can also be specified. For example "sg_inq /dev/sda" will work in
206       the 2.6 series kernels. From lk 2.6.6 other SCSI  "char"  device  names
207       may be used as well (e.g. "/dev/st0m").
208
209       The  DEVICE  is  opened  with  a  read-only flag (e.g. in Unix with the
210       O_RDONLY flag).
211

EXIT STATUS

213       The exit status of sg_vpd is 0 when it is successful. Otherwise see the
214       sg3_utils(8) man page.
215

EXAMPLES

217       The  examples  in this page use Linux device names. For suitable device
218       names in other supported Operating Systems  see  the  sg3_utils(8)  man
219       page.
220
221       To  see  the VPD pages that a device supports, use with no options. The
222       command line invocation is shown first followed by a typical response:
223
224          # sg_vpd /dev/sdb
225       Supported VPD pages VPD page:
226         Supported VPD pages [sv]
227         Unit serial number [sn]
228         Device identification [di]
229         Extended inquiry data [ei]
230         Block limits (SBC) [bl]
231
232       To see the VPD page numbers associated with each  supported  page  then
233       add  the  '--long' option to the above command line. To view a VPD page
234       either its number or abbreviation can be given to the '--page=' option.
235       The  page name abbreviations are shown within square brackets above. In
236       the next example the Extended inquiry data VPD page is listed:
237
238          # sg_vpd --page=ei /dev/sdb
239       extended INQUIRY data VPD page:
240         ACTIVATE_MICROCODE=0 SPT=0 GRD_CHK=0 APP_CHK=0 REF_CHK=0
241         UASK_SUP=0 GROUP_SUP=0 PRIOR_SUP=0 HEADSUP=1 ORDSUP=1 SIMPSUP=1
242         WU_SUP=0 CRD_SUP=0 NV_SUP=0 V_SUP=0
243         P_I_I_SUP=0 LUICLR=0 R_SUP=0 CBCS=0
244         Multi I_T nexus microcode download=0
245         Extended self-test completion minutes=0
246         POA_SUP=0 HRA_SUP=0 VSA_SUP=0
247
248       To check if any protection types  are  supported  by  a  disk  use  the
249       '--long' option on the Extended inquiry data VPD page:
250
251          # sg_vpd --page=ei --long /dev/sdb
252          extended INQUIRY data VPD page:
253            ACTIVATE_MICROCODE=0
254            SPT=1 [protection types 1 and 2 supported]
255            GRD_CHK=1
256            ....
257
258       Search for the name (and acronym) of all pages that share VPD page num‐
259       ber 0xb0 .
260
261          # sg_vpd --page=0xb0 --enumerate
262          Matching standard VPD pages:
263            bl         0xb0      Block limits (SBC)
264            oi         0xb0      OSD information
265            sad        0xb0      Sequential access device capabilities (SSC)
266
267       Some examples follow using the "--all" option. Send an ASCII  hexadeci‐
268       mal representation of all VPD pages to a file:
269
270          # sg_vpd --all -HHHH /dev/sg3 > all_vpds.hex
271
272       At some later time that file could be decoded with:
273
274          # sg_vpd --all --inhex=all_vpds.hex
275
276       To  do the equivalent as the previous example but use a file containing
277       binary:
278
279          # sg_vpd --all --raw /dev/sg3 > all_vpds.bin
280          # sg_vpd --all --raw --inhex=all_vpds.bin
281
282       Notice that "--raw" must be given with the second (--inhex)  invocation
283       to  alert  the  utility that all_vpds.bin contains binary as it assumes
284       ASCII hexadecimal by default. Next we only  decode  T10  specified  VPD
285       pages  excluding  vendor  specific  VPD pages that start at page number
286       0xc0:
287
288          # sg_vpd --all --page=0xbf --raw --inhex=all_vpds.bin
289
290       Further      examples       can       be       found       on       the
291       http://sg.danny.cz/sg/sg3_utils.html web page.
292

AUTHOR

294       Written by Douglas Gilbert
295

REPORTING BUGS

297       Report bugs to <dgilbert at interlog dot com>.
298
300       Copyright © 2006-2018 Douglas Gilbert
301       This  software is distributed under a FreeBSD license. There is NO war‐
302       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
303       POSE.
304

SEE ALSO

306       sg_inq(sg3_utils), sg3_utils(sg3_utils), sdparm(sdparm), hdparm(hdparm)
307
308
309
310sg3_utils-1.43                    March 2018                         SG_VPD(8)
Impressum