SG_VPD(8)
π
SG_VPD(8) β like, the whole sg3_utils situation π
Okok so bestie, before we even start: this is sg_vpd from the sg3_utils crew, section 8 of the manual (that's the "system administration" section, iykyk). Buckle up, it's giving β¨SCSIβ¨.
β¨ NAME β¨
sg_vpd β fetch a SCSI VPD page and/or decode its response π¦
β¨ SYNOPSIS β¨
sg_vpd [--all] [--descriptors] [--enumerate] [--examine] [--force]
[--help] [--hex] [--ident] [--inhex=FN] [--json[=JO]] [--js-file=JFN]
[--long] [--maxlen=LEN] [--page=PG] [--quiet] [--raw] [--sinq_inraw=RFN]
[--vendor=VP] [--verbose] [--version] [DEVICE]
β¨ DESCRIPTION β¨
So, like, what does this even do? π
When you hand it a DEVICE, this utility goes and fetches a Vital Product Data (VPD) page β and then either decodes it, or spits it back out at you as ASCII hexadecimal or straight-up binary. The actual fetching happens with a SCSI INQUIRY command. That's the whole vibe. π
Alternatively? You can hit it with the --inhex=FN option instead. In that case, FN is assumed to be a file name (- means stdin, classic) containing ASCII hexadecimal that represents a VPD page response. And if you also pass --raw? Then it assumes the input is binary instead of ASCII hexadecimal. Plot twist. π
Probably the most important page is the Device Identification VPD page β page number 0x83, no cap. Since SPC-3, support for this page has been flagged as mandatory, so like... it's not optional, bestie, it's the law. π You can grab this page by using the --ident option. Easy.
The reference document used for interpreting VPD pages (and also the INQUIRY standard response, while we're at it) is T10/BSR INCITS 566 Revision 6, which is draft SPC-6 dated 22 October 2021. You can find it at https://www.t10.org. Go off, T10. π
And here's the cute part: when you give it no options other than a DEVICE, it fetches and decodes the "Supported VPD pages" (0x0) VPD page. That's your default, and honestly? Iconic. β
β¨ OPTIONS β¨
okay so, first thing: arguments to long options are mandatory for short options as well. The options are arranged in alphabetical order based on the long option name β organized queen behavior, honestly.
-a,--allβ decode all VPD pages. When used with DEVICE the pages to be decoded are found in the "Supported VPD pages" VPD page. Pages that cannot be decoded are displayed in hex; add the--longoption to have ASCII displayed to the right of each line of hex. If this option is used with the--inhex=FNoption then the file FN is assumed to contain 1 or more VPD pages (in ASCII hex or binary). Decoding continues until the file is exhausted (or an error occurs). Sanity checks are applied on each VPD page's length and the ascending order of VPD page numbers (required by SPC-4) so bad data may be detected. If the--page=PGoption is also given then no VPD page whose page number is greater than PG (or its numeric equivalent) is decoded.-d,--descriptorsβ this option causes the standard INQUIRY command to be sent and its response to be decoded followed by any version descriptors found. This option implicitly sets--page=sinqand will generate an error if--page=PGtries to set a different value. The long form of this option can be shortened to--desc.-e,--enumerateβ list the names of the known VPD pages, first the standard pages (i.e. those defined by T10), then the vendor specific pages. Each group is sorted in abbreviation order. The DEVICE and most other options are ignored and this utility exits after listing the VPD page names. May be used together with--page=PGwhere PG is numeric. If so, it searches for the summary lines of all VPD pages whose number matches PG. May be used with--vendor=VPto restrict output to known vendor specific pages for vendor/product VP.-E,--examineβ scan part of all of the VPD space (page numbers0x0to0xff) and output any pages found. If this option is given once, the scan starts at page0x80; if it is given twice, the scan starts at0x0; and if given three times the scan starts at0xc0. This option takes no notice of the contents of VPD page0x0which should contain a list of all supported VPD pages. Some vendors either forget to list some standard pages or perhaps purposely don't list vendor specific pages which are in the range0xc0to0xff. If the--page=PGoption is not given then the scan finishes at page0xff. if the--page=PGoption is given then the scan finishes at page PG. A check is made before the scan to make sure the start page is less than or equal to the finish page; if not the start and finish page numbers are swapped. Thesdparmutility which lists mode and VPD pages also has a--examineoption with similar functionality. Note that T10 has changed most of the pages that list supported pages (e.g. VPD, mode and log pages; supported commands) to add the weasel words "may or may not list all ...".-f,--forceβ As a sanity check, the normal action when fetching VPD pages other than page0x0(the "Supported VPD pages" VPD page), is to first fetch page0x0and only if the requested page is one of the supported pages, to go ahead and fetch the requested page. When this option is given, skip checking of VPD page0x0before accessing the requested VPD page. The prior check of VPD page0x0is known to crash certain USB devices, so use with care.-h,--helpβ outputs the usage message summarizing command line options then exits. Ignores DEVICE if given.-H,--hexβ outputs the requested VPD page in ASCII hexadecimal. Can be used multiple times, see section on the ATA information vpd page. To generate output suitable for placing in a file that can be used by a later invocation with the--inhex=FNoption, use the-HHHHoption (e.g.'sg_vpd -p di -HHHH /dev/sg3 > dev_id.hex'). The reason-HHHHis used is to flag that unadorned hexadecimal (without other text or address offsets) is sent tostdout.-i,--identβ decode the device identification (0x83) VPD page. When used once this option has the same effect as--page=di. When used twice then the short form of the device identification VPD page's logical unit designator is decoded. In the latter case this option has the same effect as--quiet --page=di_lu.-I,--inhex=FNβ FN is expected to be a file name (or-for stdin) which contains ASCII hexadecimal or binary representing a VPD page (or a standard INQUIRY) response. This utility will then decode that response. It is preferable to also supply the--page=PGoption, if not this utility will attempt to guess which VPD page (or standard INQUIRY) the response is associated with. The hexadecimal should be arranged as 1 or 2 digits representing a byte each of which is whitespace or comma separated. Anything from and including a hash mark to the end of line is ignored. If the--rawoption is also given then FN is treated as binary.-j[=JO],--json[=JO]β output is in JSON format instead of plain text form. Note that arguments to the short and long form are themselves optional and if present start with=and no whitespace is permitted around that=. Seesg3_utils_jsonmanpage or use?for JO to get a summary.-J,--js-file=JFNβ output is in JSON format and it is sent to a file named JFN. If that file exists then it is truncated. By default, the JSON output is sent to stdout. When this option is given, the--json[=JO]option is implied and need not be given. The--json[=JO]option may still be needed to set the JO parameter to non-default values.-l,--longβ when decoding some VPD pages, give a little more output. For example the ATA Information VPD page only shows the signature (in hex) and the IDENTIFY (PACKET) DEVICE (in hex) when this option is given.-m,--maxlen=LENβ where LEN is the (maximum) response length in bytes. It is placed in the cdb's "allocation length" field. If not given (or LEN is zero) then252is used (apart from the ATA Information VPD page which defaults to572) and, if the response indicates this value is insufficient, another INQUIRY command is sent with a larger value in the cdb's "allocation length" field. If this option is given and LEN is greater than0then only one INQUIRY command is sent. Since many simple devices implement the INQUIRY command badly (and do not support VPD pages) then the safest value to use for LEN is36. See thesg_inq(8)man page for more information.-p,--page=PGβ where PG is the VPD page to be decoded or output. The PG argument can either be an abbreviation, a number or a pair of numbers/abbreviations separated by a comma. The VPD page abbreviations can be seen by using the--enumerateoption. If a number is given it is assumed to be decimal unless it has a hexadecimal indicator which is either a leading0xor a trailingh. If one number is given then it is assumed to be a VPD page number. If two numbers (or abbreviations) are given then the second one is the same as VP (see the--vendor=VPoption). If this option is not given (nor-i,-lnor-V) then the "Supported VPD pages" (0x0) VPD page is fetched and decoded. If PG is-1orsinqthen the standard INQUIRY response is output. This option may also be used with the--enumerate(see its description). If PG is not found in the "Supported VPD pages" VPD page (0x0) then a"numerical argument out of domain"[EDOM]error is returned. To bypass this check use the--forceoption.-q,--quietβ suppress the amount of decoding and error output.-r,--rawβ if not used with--inhex=FNthen output requested VPD page in binary. The output should be piped to a file or another utility when this option is used. The binary is sent tostdout, and errors are sent tostderr. if used with--inhex=FNthen the contents of FN is treated as binary.-Q,--sinq_inraw=RFNβ where RFN is a filename containing binary standard INQUIRY response data that matches either DEVICE or FN. Linux places this standard INQUIRY response in its sysfs pseudo filesystem. A typical location is at/sys/class/scsi_device/<hctl>/device/inquirywhere<hctl>is a four part numeric tuple separated by colons. This tuple distinguishes the device from any others on the system. Linux also places some VPD page responses in binary in the same directory with names like"vpd_pg83"where the last two digits form the hexadecimal VPD page number whose binary contents are therein. Some VPD pages (e.g. the Extended Inquiry VPD page) depend on knowing the settings in the standard INQUIRY response to interpret the fields in that VPD page. This option together with the--all,--examineor--page=PGallows this utility to process both the standard INQUIRY response and VPD pages in the same invocation. The--rawoption has no effect on this option. The DEVICE argument may be given with this option.-M,--vendor=VPβ where VP is a vendor (e.g."sea"for Seagate) or vendor/product acronym (e.g."hp3par"for the 3PAR array from HP). Many vendors have re-used the numbers at the beginning of the vendor specific VPD page range (e.g. page0xc0) and this option is a way of selecting only those which are of interest. Using a VP of"xxx"will list the available acronyms. If this option is used with--page=PGand PG is an acronym then this option is ignored. If PG is a number (e.g.0xc0) then VP is used to choose the which vendor specific page (e.g. sharing page number0xc0) to decode.-v,--verboseβ increases the level or verbosity.-V,--versionβ print out version string then exit.
πΈ ATA INFORMATION VPD PAGE πΈ
Okay so this VPD page β it's page 0x89 or 'ai' β is defined by the SCSI to ATA Translation standard. It's basically the SAT layer's little info dump: 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 β not its job, not its era π
).
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. Iconic pipeline behavior, no cap β¨
π NOTES π
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).
The DEVICE is opened with a read-only flag (e.g. in Unix with the O_RDONLY flag). She's just looking, not touching π
π¦ EXIT STATUS π¦
The exit status of sg_vpd is 0 when it is successful. Otherwise see the sg3_utils(8) man page. Zero means slay, anything else means go read the other page bestie π
π EXAMPLES π
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
In Linux, binary images of some important VPD page responses (e.g. 0, 80h and 83h) are cached in files within the sysfs pseudo file system. Since VPD pages hardly ever change their contents, decoding those files will give the same output as probing the device with the added benefit that decoding those files doesn't need root permissions. The long and short forms are shown:
sg_vpd --raw --inhex=/sys/class/scsi_generic/sg3/device/vpd_pg83
sg_vpd -rI /sys/class/scsi_generic/sg3/device/vpd_pg83
If /dev/sg3 is a disk at 2:0:0:0 , then this invocation should give more verbose output but essentially the same as the previous two examples.
sg_vpd -v -r -I /sys/class/scsi_disk/2:0:0:0/device/vpd_pg83
Further examples can be found on the https://sg.danny.cz/sg/sg3_utils.html web page. Go browse, it's giving documentation excellence π«Ά
π AUTHOR π
Written by Douglas Gilbert. Main character energy fr fr π
π REPORTING BUGS π
Report bugs to <dgilbert at interlog dot com>. Be nice, be specific, include the details bestie π
π COPYRIGHT π
Copyright Β© 2006-2026 Douglas Gilbert
This software is distributed under a BSD-2-Clause license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Like, absolutely zero promises, periodt π
β SEE ALSO β
sg_inq(sg3_utils)sg3_utils(sg3_utils)sdparm(sdparm)hdparm(hdparm)
Okay that's literally the whole page bestie π this one's from sg3_utils-1.49, dated 2026-07-12, and it's the SG_VPD(8) manual β slay, you're officially VPD-pilled β¨π
π¦ where this page comes from
- arch rolling: sg3_utils 1.49-1 Β· GPL-2.0-or-later AND BSD-2-Clause
- nixpkgs unstable: sg3_utils 1.49
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms