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

ATA INFORMATION VPD PAGE

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

NOTES

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

EXIT STATUS

201       The exit status of sg_vpd is 0 when it is successful. Otherwise see the
202       sg3_utils(8) man page.
203

EXAMPLES

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

AUTHOR

282       Written by Douglas Gilbert
283

REPORTING BUGS

285       Report bugs to <dgilbert at interlog dot com>.
286
288       Copyright © 2006-2016 Douglas Gilbert
289       This software is distributed under a FreeBSD license. There is NO  war‐
290       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
291       POSE.
292

SEE ALSO

294       sg_inq(sg3_utils), sg3_utils(sg3_utils), sdparm(sdparm), hdparm(hdparm)
295
296
297
298sg3_utils-1.42                   February 2016                       SG_VPD(8)
Impressum