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]  [--examine]  [--force] [--help] [--hex]
10       [--ident] [--inhex=FN] [--long]  [--maxlen=LEN]  [--page=PG]  [--quiet]
11       [--raw] [--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  22  which  is  draft
30       SPC-5 revision 19, 22 April 2019. It can be found at http://www.t10.org
31       .
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       -E, --examine
68              scan  part of all of the VPD space (from 0x0 to 0xff) and output
69              any pages found. This option ignores the contents  of  VPD  page
70              0x0 which should contain a list of all supported VPD pages. How‐
71              ever some vendors either forget to list some standard  pages  or
72              perhaps  purposely don't list vendor specific pages which are in
73              the range 0xc0 to 0xff.
74              If the --page=PG option is not given and this  option  is  given
75              once  then  the scan is from VPD page number 0x80 to 0xff inclu‐
76              sive. If the --page=PG option is given then  the  scan  is  from
77              0x80  to  PG  inclusive.  If this option is given twice then the
78              scan starts at VPD page 0x0.
79              The sdparm utility which lists mode and VPD  pages  also  has  a
80              --examine option will similar functionility.
81
82       -f, --force
83              As  a  sanity  check,  the normal action when fetching VPD pages
84              other than page 0x0 (the "Supported VPD pages" VPD page), is  to
85              first  fetch  page  0x0 and only if the requested page is one of
86              the supported pages, to go ahead and fetch the requested page.
87              When this option is given, skip checking of VPD page 0x0  before
88              accessing  the  requested  VPD page. The prior check of VPD page
89              0x0 is known to crash certain USB devices, so use with care.
90
91       -h, --help
92              outputs the usage message summarizing command line options  then
93              exits.  Ignores DEVICE if given.
94
95       -H, --hex
96              outputs the requested VPD page in ASCII hexadecimal. Can be used
97              multiple times, see section on the ATA information vpd page.
98              To generate output suitable for placing in a file  that  can  be
99              used  by  a later invocation with the --inhex=FN option, use the
100              '-HHHH'  option  (e.g.  'sg_vpd   -p   di   -HHHH   /dev/sg3   >
101              dev_id.hex').  The  reason  '-HHHH'  is  used  is  to  flag that
102              unadorned hexadecimal (without other text or address offsets) is
103              sent to stdout.
104
105       -i, --ident
106              decode the device identification (0x83) VPD page. When used once
107              this option has the same effect as '--page=di'. When  use  twice
108              then the short form of the device identification VPD page's log‐
109              ical unit designator is decoded. In the latter case this  option
110              has the same effect as '--quiet --page=di_lu'.
111
112       -I, --inhex=FN
113              FN  is  expected to be a file name (or '-' for stdin) which con‐
114              tains ASCII hexadecimal or binary representing a VPD page (or  a
115              standard  INQUIRY)  response. This utility will then decode that
116              response. It is preferable to also supply the --page=PG  option,
117              if  not  this  utility  will attempt to guess which VPD page (or
118              standard INQUIRY) the response is associated with. The hexadeci‐
119              mal should be arranged as 1 or 2 digits representing a byte each
120              of which is whitespace or comma  separated.  Anything  from  and
121              including  a  hash  mark  to  the end of line is ignored. If the
122              --raw option is also given then FN is treated as binary.
123
124       -l, --long
125              when decoding some VPD pages, give a  little  more  output.  For
126              example  the  ATA  Information VPD page only shows the signature
127              (in hex) and the IDENTIFY (PACKET) DEVICE  (in  hex)  when  this
128              option is given.
129
130       -m, --maxlen=LEN
131              where  LEN  is  the  (maximum)  response  length in bytes. It is
132              placed in the cdb's "allocation length" field. If not given  (or
133              LEN  is  zero)  then 252 is used (apart from the ATA Information
134              VPD page which defaults to 572) and, if the  response  indicates
135              this value is insufficient, another INQUIRY command is sent with
136              a larger value in the cdb's "allocation length" field.  If  this
137              option  is given and LEN is greater than 0 then only one INQUIRY
138              command is sent. Since many simple devices implement the INQUIRY
139              command  badly  (and  do  not support VPD pages) then the safest
140              value to use for LEN is 36. See the sg_inq man page for the more
141              information.
142
143       -p, --page=PG
144              where  PG  is the VPD page to be decoded or output. The PG argu‐
145              ment can either be an abbreviation, a number or a pair  or  num‐
146              bers/abbreviations  separated by a comma. The VPD page abbrevia‐
147              tions can be seen by using the --enumerate option. If  a  number
148              is given it is assumed to be decimal unless it has a hexadecimal
149              indicator which is either a leading '0x' or a trailing  'h'.  If
150              one  number is given then it is assumed to be a VPD page number.
151              If two numbers (or abbreviations) are given then the second  one
152              is  the  same as VP (see the --vendor=VP option). If this option
153              is not given (nor '-i', '-l' nor '-V') then the  "Supported  VPD
154              pages"  (0x0)  VPD page is fetched and decoded. If PG is '-1' or
155              'sinq' then the standard INQUIRY response is output. This option
156              may also be used with the --enumerate (see its description).
157              If  PG  is not found in the 'Supported VPD pages' VPD page (0x0)
158              then EDOM is returned. To bypass  this  check  use  the  --force
159              option.
160
161       -q, --quiet
162              suppress the amount of decoding output.
163
164       -r, --raw
165              if  not  used  with --inhex=FN then output requested VPD page in
166              binary.  The output should be piped to a file or another utility
167              when  this  option  is  used.  The binary is sent to stdout, and
168              errors are sent to stderr.
169              if used with --inhex=FN then the contents of FN  is  treated  as
170              binary.
171
172       -M, --vendor=VP
173              where  VP is a vendor (e.g. "sea" for Seagate) or vendor/product
174              acronym (e.g. "hp3par" for the 3PAR array from HP). Many vendors
175              have re-used the numbers at the beginning of the vendor specific
176              VPD page range (e.g.  page 0xc0) and this option  is  a  way  of
177              selecting  only those which are of interest. Using a VP of "xxx"
178              will list the available acronyms.
179              If this option is used with --page=PG and PG is an acronym  then
180              this option is ignored. If PG is a number (e.g. 0xc0) then VP is
181              used to choose the which vendor specific page (e.g. sharing page
182              number 0xc0) to decode.
183
184       -v, --verbose
185              increases the level or verbosity.
186
187       -V, --version
188              print out version string then exit.
189

ATA INFORMATION VPD PAGE

191       This  VPD page (0x89 or 'ai') is defined by the SCSI to ATA Translation
192       standard. It contains information about the SAT layer, the  "signature"
193       of  the ATA device and the response to the ATA IDENTIFY (PACKET) DEVICE
194       command. The latter part has 512 bytes of identity, capability and set‐
195       tings  data  which  the  hdparm utility is capable of decoding (so this
196       utility doesn't decode it).
197
198       To unclutter the output for this page, the signature and  the  IDENTIFY
199       (PACKET)  DEVICE  response  are not output unless the --long option (or
200       --hex or --raw) are given. When the --long option is given the IDENTIFY
201       (PACKET)  DEVICE  response  is  output  as 256 (16 bit) words as is the
202       fashion for ATA devices. To see that response as a string of bytes  use
203       the  '-HH'  option.  To format the output suitable for hdparm to decode
204       use either the '-HHH' or '-rr' option. For example if  'dev/sdb'  is  a
205       SATA  disk  behind  a  SAT  layer then this command: 'sg_vpd -p ai -HHH
206       /dev/sdb | hdparm --Istdin' should decode  the  ATA  IDENTIFY  (PACKET)
207       DEVICE response.
208

NOTES

210       Since  some  VPD  pages (e.g. the Extended INQUIRY page) depend on set‐
211       tings in the standard  INQUIRY  response,  then  the  standard  INQUIRY
212       response  is  output  as  a  pseudo  VPD page when PG is set to '-1' or
213       'sinq'. Also the decoding of some fields  (e.g.  the  Extended  INQUIRY
214       page's  SPT  field) is expanded when the '--long' option is given using
215       the standard INQUIRY response information (e.g. the PDT and the PROTECT
216       fields).
217
218       In  the  2.4  series of Linux kernels the DEVICE must be a SCSI generic
219       (sg) device. In the 2.6 series block  devices  (e.g.  disks  and  ATAPI
220       DVDs) can also be specified. For example "sg_inq /dev/sda" will work in
221       the 2.6 series kernels. From lk 2.6.6 other SCSI  "char"  device  names
222       may be used as well (e.g. "/dev/st0m").
223
224       The  DEVICE  is  opened  with  a  read-only flag (e.g. in Unix with the
225       O_RDONLY flag).
226

EXIT STATUS

228       The exit status of sg_vpd is 0 when it is successful. Otherwise see the
229       sg3_utils(8) man page.
230

EXAMPLES

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

AUTHOR

309       Written by Douglas Gilbert
310

REPORTING BUGS

312       Report bugs to <dgilbert at interlog dot com>.
313
315       Copyright © 2006-2019 Douglas Gilbert
316       This  software is distributed under a FreeBSD license. There is NO war‐
317       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
318       POSE.
319

SEE ALSO

321       sg_inq(sg3_utils), sg3_utils(sg3_utils), sdparm(sdparm), hdparm(hdparm)
322
323
324
325sg3_utils-1.45                    April 2019                         SG_VPD(8)
Impressum