SG_VPD(8) | SG3_UTILS | SG_VPD(8) |
sg_vpd - fetch SCSI VPD page and/or decode its response
sg_vpd [--all] [--enumerate] [--force] [--help] [--hex] [--ident] [--inhex=FN] [--long] [--maxlen=LEN] [--page=PG] [--quiet] [--raw] [--vendor=VP] [--verbose] [--version] [DEVICE]
This utility, when DEVICE is given, fetches a Vital Product Data (VPD) page and decodes it or outputs it in ASCII hexadecimal or binary. VPD pages are fetched with a SCSI INQUIRY command.
Alternatively the --inhex=FN option can be given. In this case FN is assumed to be a file name ('-' for stdin) containing ASCII hexadecimal representing a VPD page response. If the --raw option is also given then binary input is assumed (rather than ASCII hexadecimal).
Probably the most important page is the Device Identification VPD page (page number: 0x83). Since SPC-3, support for this page has been flagged as mandatory. This page can be fetched by using the --ident option.
The reference document used for interpreting VPD pages (and the INQUIRY standard response) is T10/BSR INCITS 502 Revision 19 which is draft SPC-5 revision 19, 14 February 2018). It can be found at http://www.t10.org .
When no options are given, other than a DEVICE, then the "Supported VPD pages" (0x0) VPD page is fetched and decoded.
Arguments to long options are mandatory for short options as well. The options are arranged in alphabetical order based on the long option name.
This VPD page (0x89 or 'ai') is defined by the SCSI to ATA Translation standard. It contains information about the SAT layer, the "signature" of the ATA device and the response to the ATA IDENTIFY (PACKET) DEVICE command. The latter part has 512 bytes of identity, capability and settings data which the hdparm utility is capable of decoding (so this utility doesn't decode it).
To unclutter the output for this page, the signature and the IDENTIFY (PACKET) DEVICE response are not output unless the --long option (or --hex or --raw) are given. When the --long option is given the IDENTIFY (PACKET) DEVICE response is output as 256 (16 bit) words as is the fashion for ATA devices. To see that response as a string of bytes use the '-HH' option. To format the output suitable for hdparm to decode use either the '-HHH' or '-rr' option. For example if 'dev/sdb' is a SATA disk behind a SAT layer then this command: 'sg_vpd -p ai -HHH /dev/sdb | hdparm --Istdin' should decode the ATA IDENTIFY (PACKET) DEVICE response.
Since some VPD pages (e.g. the Extended INQUIRY page) depend on settings in the standard INQUIRY response, then the standard INQUIRY response is output as a pseudo VPD page when PG is set to '-1' or 'sinq'. Also the decoding of some fields (e.g. the Extended INQUIRY page's SPT field) is expanded when the '--long' option is given using the standard INQUIRY response information (e.g. the PDT and the PROTECT fields).
In the 2.4 series of Linux kernels the DEVICE must be a SCSI generic (sg) device. In the 2.6 series 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").
The DEVICE is opened with a read-only flag (e.g. in Unix with the O_RDONLY flag).
The exit status of sg_vpd is 0 when it is successful. Otherwise see the sg3_utils(8) man page.
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.
To see the VPD pages that a device supports, use with no options. The command line invocation is shown first followed by a typical response:
# sg_vpd /dev/sdb
Supported VPD pages VPD page:
Supported VPD pages [sv]
Unit serial number [sn]
Device identification [di]
Extended inquiry data [ei]
Block limits (SBC) [bl]
To see the VPD page numbers associated with each supported page then add the '--long' option to the above command line. To view a VPD page either its number or abbreviation can be given to the '--page=' option. The page name abbreviations are shown within square brackets above. In the next example the Extended inquiry data VPD page is listed:
# sg_vpd --page=ei /dev/sdb
extended INQUIRY data VPD page:
ACTIVATE_MICROCODE=0 SPT=0 GRD_CHK=0 APP_CHK=0 REF_CHK=0
UASK_SUP=0 GROUP_SUP=0 PRIOR_SUP=0 HEADSUP=1 ORDSUP=1 SIMPSUP=1
WU_SUP=0 CRD_SUP=0 NV_SUP=0 V_SUP=0
P_I_I_SUP=0 LUICLR=0 R_SUP=0 CBCS=0
Multi I_T nexus microcode download=0
Extended self-test completion minutes=0
POA_SUP=0 HRA_SUP=0 VSA_SUP=0
To check if any protection types are supported by a disk use the '--long' option on the Extended inquiry data VPD page:
# sg_vpd --page=ei --long /dev/sdb
extended INQUIRY data VPD page:
ACTIVATE_MICROCODE=0
SPT=1 [protection types 1 and 2 supported]
GRD_CHK=1
....
Search for the name (and acronym) of all pages that share VPD page number 0xb0 .
# sg_vpd --page=0xb0 --enumerate
Matching standard VPD pages:
bl 0xb0 Block limits (SBC)
oi 0xb0 OSD information
sad 0xb0 Sequential access device capabilities (SSC)
Some examples follow using the "--all" option. Send an ASCII hexadecimal representation of all VPD pages to a file:
# sg_vpd --all -HHHH /dev/sg3 > all_vpds.hex
At some later time that file could be decoded with:
# sg_vpd --all --inhex=all_vpds.hex
To do the equivalent as the previous example but use a file containing binary:
# sg_vpd --all --raw /dev/sg3 > all_vpds.bin
# sg_vpd --all --raw --inhex=all_vpds.bin
Notice that "--raw" must be given with the second (--inhex) invocation to alert the utility that all_vpds.bin contains binary as it assumes ASCII hexadecimal by default. Next we only decode T10 specified VPD pages excluding vendor specific VPD pages that start at page number 0xc0:
# sg_vpd --all --page=0xbf --raw --inhex=all_vpds.bin
Further examples can be found on the http://sg.danny.cz/sg/sg3_utils.html web page.
Written by Douglas Gilbert
Report bugs to <dgilbert at interlog dot com>.
Copyright © 2006-2018 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sg_inq(sg3_utils), sg3_utils(sg3_utils), sdparm(sdparm), hdparm(hdparm)
March 2018 | sg3_utils-1.43 |