SG_INQ(8)
πΈ NAME πΈ
sg_inq β issue SCSI INQUIRY command and/or decode its response π
(hi bestie, this is sg_inq from the sg3_utils squad, and yes she IS that girl β¨)
π SYNOPSIS π
sg_inq [--ata] [--block=0|1] [--cmddt] [--descriptors] [--export]
[--extended] [--force] [--help] [--hex] [--id] [--inhex=FN]
[--json[=JO]] [--js-file=JFN] [--len=LEN] [--long] [--maxlen=LEN]
[--only] [--page=PG] [--quiet] [--raw] [--sinq_inraw=RFN] [--vendor]
[--verbose] [--version] [--vpd] DEVICE
sg_inq [-36] [-a] [-A] [-b] [--B=0|1] [-c] [-cl] [-d] [-e] [-f] [-h]
[-H] [-i] [-I=FN] [-j[=JO]] [-l=LEN] [-L] [-m] [-M] [-o] [-p=VPD_PG]
[-P] [-q] [-r] [-s] [-u] [-v] [-V] [-x] [-36] [-?] DEVICE
π¦ DESCRIPTION π¦
okay so, when you give this utility a DEVICE, it slides a SCSI INQUIRY command over to it and then outputs the response it gets back π«Ά. And like β every SCSI device is supposed to answer a "standard" INQUIRY with at least a 36 byte response (that's been the vibe since SCSI 2 and higher, no cap). An INQUIRY counts as "standard" when both the EVPD and CmdDt (which is now obsolete, rip) bits are clear. Formally (like, as per the SPC standards, being all official about it) the name of a standard INQUIRY response is the "standard INQUIRY data format" β but here we just call it the "standard INQUIRY response" because it's shorter and honestly more descriptive π.
Alternatively you can pass the --inhex=FN option. In that case FN is assumed to be a file name (- means stdin, iconic) containing ASCII hexadecimal that represents an INQUIRY response π.
This utility supports two command line syntaxes, bestie. The preferred one is shown first in the synopsis and is described in the main OPTIONS section. A later section titled OLDER COMMAND LINE OPTIONS describes the second group of options π
An important "non-standard" INQUIRY page is the Device Identification Vital Product Data (VPD) page [0x83]. Since SPC-3, support for this page is mandatory, periodt. The --id option decodes this page. New VPD page information is no longer being added to this utility β the sg_vpd(8) utility is specialized for decoding VPD pages and shares code with this utility for that purpose π§. The sdparm(8) utility, which is in a package of that name, also decodes VPD pages, although its major purpose is to access and modify SCSI mode pages.
In Linux, if the DEVICE exists and the SCSI INQUIRY fails (e.g. because the SG_IO ioctl is not supported) then an ATA IDENTIFY (PACKET) DEVICE is tried π. If it succeeds then device identification strings are output. The --raw and --hex options can be used to manipulate the output. If the --ata option is given then the SCSI INQUIRY is not performed and the DEVICE is assumed to be ATA (or ATAPI). For more information see the ATA DEVICES section below π.
In some operating systems a NVMe device (e.g. SSD) may be given as the DEVICE. For more information see the NVME DEVICES section below β¨.
The reference document used for interpreting an INQUIRY is T10/BSR INCITS 566 Revision 6 which is draft SPC-6 dated 22 October 2021. It can be found at https://www.t10.org. Obsolete and reserved items in the standard INQUIRY response output are displayed in square brackets π.
β¨ OPTIONS β¨
Arguments to long options are mandatory for short options as well, so don't get cute and skip them π. The options are arranged in alphabetical order based on the long option name.
-a,--ataβ This option is only available in Linux π§. Assume the givenDEVICEis an ATA or ATAPI device which can receive ATA commands from the host operating system. Skip the SCSI INQUIRY command and use either the ATA IDENTIFY DEVICE command (for non-packet devices) or the ATA IDENTIFY PACKET DEVICE command. Additionally, to show the response in hex (512 bytes or 256 words long), add the--longor--verboseoption.
DEVICE must be a block device (i.e. not a pass-through like /dev/sg3) and be directly connected (i.e. not via SAS infrastructure). If DEVICE is connected via SAS infrastructure then this option should not be used β this utility will report using the SCSI to ATA Translation (SAT) layer π.
-B,--block=0|1β this option controls how the file handle to theDEVICEis opened. If this argument is0then the open is non-blocking. If the argument is1then the open is blocking. In Unix a non-blocking open is indicated by aO_NONBLOCKflag while a blocking open is indicated by the absence of that flag. The default value depends on the operating system and the type ofDEVICEnode πΈ. For Linux pass-throughs (i.e. the sg and bsg drivers) the default is0.-c,--cmddtβ set the Command Support Data (CmdDt) bit (defaults to clear(0)). Used in conjunction with the--page=PGoption wherePGspecifies the SCSI command opcode to query. When used twice (e.g.'-cc') this utility forms a list by looping over all 256 opcodes (0to255inclusive) only outputting a line for commands that are found π. The CmdDt bit is now obsolete; it has been replaced by the REPORT SUPPORTED OPERATION CODES command, see thesg_opcodes(8)utility.-d,--descriptorsβ decodes and prints the version descriptors found in a standard INQUIRY response. There are up to 8 of them π. Version descriptors indicate which versions of standards and/or drafts theDEVICEcomplies with. The normal components of a standard INQUIRY are output (typically from the first 36 bytes of the response) followed by the version descriptors if any.-eβ see entry below for--vpdπ.-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 page 0x0 is known to crash certain USB devices, so use with care, bestie. fr fr π
-u,--exportβ prints out information obtained from the device. The output can be modified by selecting a VPD page withPG(from--page=PG). If the device identification VPD page0x83is given it prints out information in the form:"SCSI_IDENT_<assoc>_<type>=<ident>"to stdout. If the device serial number VPD page0x80is given it prints out information in the form:"SCSI_SERIAL=<ident>"π. Other VPD pages are not supported. If no VPD page is given it prints out information in the form:"SCSI_VENDOR=<vendor>","SCSI_MODEL=<model>", and"SCSI_REVISION=<rev>", taken from the standard inquiry. This may be useful for tools likeudev(7)in Linux.
This option takes precedence over the JSON options which will be ignored π
-E,-x,--extendedβ prints the extended INQUIRY VPD page [0x86] π. It has the same effect as giving the--page=eioption.-h,--helpβ print out the usage message then exit. When used twice, after the usage message, there is a list of available abbreviations than can be given to the--page=PGoption π«Ά.-H,--hexβ rather than decode a standard INQUIRY response, a VPD page or command support data; print out the response in hex and send the output to stdout. Error messages and warnings are typically output to stderr. When used twice with the ATA Information VPD page [0x89] decodes the start of the response then outputs the ATA IDENTIFY (PACKET) DEVICE response in hexadecimal bytes (not 16 bit words) π. When used three times with the ATA Information VPD page [0x89] or the--ataoption, this utility outputs the ATA IDENTIFY (PACKET) DEVICE response in hexadecimal words suitable for input to'hdparm --Istdin'. See note below.
To generate output suitable for placing in a file that can be used by a later invocation with the --inhex=FN option, use the '-HHHH' option (e.g. 'sg_inq -p di -HHHH /dev/sg3 > dev_id.hex') π₯.
-i,--idβ prints the device identification VPD page [0x83] π. It has the same effect as giving the--page=dioption.-I,--inhex=FNβFNis expected to be a file name (or'-'for stdin) which contains ASCII hexadecimal or binary representing an INQUIRY (including VPD page) 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) that 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 a line is ignored. If the--rawoption is also given thenFNis 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"=". If the--exportoption is also given, this option is ignored. Seesg3_utils_jsonmanpage or use'?'forJOto get a summary π-J,--js-file=JFNβ output is in JSON format and it is sent to a file namedJFN. 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 theJOparameter to non-default values. If the--exportoption is also given, this option is ignored π .-l,--len=LENβ the numberLENis the "allocation length" field in the INQUIRY cdb. This is the (maximum) length of the response returned by the device π. The default value ofLENis0which is interpreted as: first request is for 36 bytes and if necessary execute another INQUIRY if the "additional length" field in the response indicates that more than 36 bytes is available.
If LEN is greater than 0 then only one INQUIRY command is performed. This means that the Serial Number (obtained from the Serial Number VPD page (0x80)) is not fetched and therefore not printed π. See the NOTES section below about "36 byte INQUIRYs".
-L,--longβ this option causes more information to be decoded from the Identify command sent to a NVMeDEVICEβ.-m,--maxlen=LENβ this option has the same action as the--len=LENoption above. It has been added for compatibility with thesg_vpd,sg_modesandsg_logsutilities π«Ά.-O,--oldβ flips you over to the older style options. Bestie, put this one first on the command line or it gets weird π-o,--onlyβ tells it not to go chasing the Serial Number VPD page (0x80) to pretty up a standard INQUIRY. So like, if you give this option and literally nothing else, the utility sends one standard INQUIRY SCSI command, decodes the response, and dips. No other SCSI commands get sent to the DEVICE. Without this option there's an extra SCSI command in the mix: a (non-standard) SCSI INQUIRY to grab that Serial Number VPD page. The tea here: that page is not mandatory (meanwhile the Device Identification page is mandatory but a billion USB keys just ignore that, iconic behaviour honestly π) and it can cause nuisance error reports. Most of the time, if you pass--maxlen=LENandLENis greater than 0, you don't even need this option.
For NVMe devices only the Identify controller is performed, even if the DEVICE includes a namespace identifier. Example from FreeBSD: give it a DEVICE named /dev/nvme0ns1 and an Identify controller goes to /dev/nvme0 and nothing at all is sent to its "ns1" (first namespace). Respectful. We love a boundary π«Ά
-p,--page=PGβ the PG argument is either a number or an abbreviation for a VPD page. Wanna see all the abbreviations available? Use-hh, or just feed it a bad abbreviation (e.g.--page=xxx) and it'll show you the list. When--cmddtis given (once) then PG is interpreted as an opcode number (so VPD page abbreviations make little sense there, lowkey pointless).
If PG is a negative number, then a standard INQUIRY is performed. Handy for overriding some of that guessing logic that comes with the --inhex=FN option. If PG isn't found in the 'Supported VPD pages' VPD page (0x0) then EDOM gets returned. Wanna skip that check? Use the --force option. Chaotic but valid π
-q,--quietβ suppresses the amount of decoding and error output. Shhh era π€«-r,--rawβ when there's no--inhex=FNoption around, the response comes out in binary. Pipe that output to a file or another utility when you use this. The binary goes tostdout, and any error messages go tostderr(keeping them separated, we stan). If you do use it with--inhex=FN, then the contents of FN are 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 puts this standard INQUIRY response in its sysfs pseudo filesystem, and a typical location is/sys/class/scsi_device/<hctl>/device/inquirywhere<hctl>is a four part numeric tuple separated by colons. That tuple is what distinguishes the device from every other one on the system, main character energy honestly π
Linux also drops some VPD page responses in binary in that same directory, with names like vpd_pg83 where the last two digits are the hexadecimal VPD page number whose binary contents live in there. Some VPD pages (e.g. the Extended Inquiry VPD page) depend on knowing the settings in the standard INQUIRY response to interpret their own fields. This option, together with --all, --examine or --page=PG, lets the utility process both the standard INQUIRY response and VPD pages in the same invocation. So efficient π
The --raw option has no effect on this option. The DEVICE argument may be given with this option.
-s,--vendorβ outputs a standard INQUIRY response's vendor specific fields from offset 36 to 55 in ASCII. Use it twice (i.e.-ss) and it also outputs the vendor specific field from offset 96 in ASCII. This only happens if the data passes some simple sanity checks β it's got standards β¨-v,--verboseβ increases the level of verbosity. Stack it, use it multiple times, go feral.-V,--versionβ prints the version string then exits. Short and sweet, periodt.-e,--vpdβ sets the Enable Vital Product Data (EVPD) bit (defaults to clear(0)). Use it alongside the--page=PGoption, where PG names the VPD page number you wanna query. If--page=PGisn't given then PG defaults to zero, which is the "Supported VPD pages" VPD page. Little default, big job π
πΈ NOTES πΈ
Okay so some devices with weak SCSI command set implementations lock up when they receive commands they don't understand (and some lock up if they get response lengths they don't expect π). Those divas need to be handled carefully β use the --len=36 option. Without it, this utility issues an initial standard INQUIRY requesting 36 bytes of response data, and if the device says it could've supplied more data, then a second INQUIRY goes out to fetch the longer response. That second command may lock up faulty devices. So like... be careful, fr fr.
ATA or ATAPI devices that use a SCSI to ATA Translation layer (see SAT at www.t10.org) may support the SCSI ATA INFORMATION VPD page. That one returns the IDENTIFY (PACKET) DEVICE response amongst other things. You can fetch the ATA Information VPD page with --page=ai π¦
In the INQUIRY standard response there's a 'MultiP' flag which is set when the device has 2 or more ports. Some vendors use the preceding vendor specific ('VS') bit to indicate which port is being accessed by the INQUIRY command (0 β relative port 1 (port "a"), 1 β relative port 2 (port "b")). When the 'MultiP' flag is set, that preceding vendor specific bit gets shown in parentheses. SPC-3 compliant devices should use the device identification VPD page (0x83) to show which port is being used for access and the SCSI ports VPD page (0x88) to show all available ports on the device. Glow-up behaviour π
In the 2.4 series of Linux kernels the DEVICE must be a SCSI generic (sg) device. In the 2.6 series and later, 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. And from lk 2.6.6, other SCSI "char" device names may be used as well (e.g. /dev/st0m). History lesson, but make it cute π
The number of bytes output by --hex and --raw is 36 bytes or whatever number you gave to --len=LEN (or --maxlen=LEN). That number gets reduced if the "resid" returned by the HBA indicates fewer bytes were sent back from DEVICE.
The DEVICE is opened with a read-only flag (e.g. in Unix with the O_RDONLY flag). Look but don't touch, bestie π
π₯ ATA DEVICES π₯
There are two major types of ATA devices: non-packet devices (e.g. ATA disks) and packet devices (ATAPI). The majority of ATAPI devices are CD/DVD/BD drives in which the ATAPI transport carries the MMC set (i.e. a SCSI command set). Further, both types of ATA devices can be connected to a host computer via a "SCSI" (or some other) transport.
When an ATA disk is controlled via a SCSI (or non-ATA) transport then two approaches are commonly used: tunnelling (e.g. STP in Serial Attached SCSI (SAS)) or emulating a SCSI device (e.g. with a SCSI to ATA translation layer, see SAT at www.t10.org). Even when the physical transport to the host computer is ATA (especially in the case of SATA) the operating system may choose to put a SAT layer in the driver "stack" (e.g. libata in Linux). Sneaky but valid π
The main identifying command for any SCSI device is an INQUIRY. The corresponding command for an ATA non-packet device is IDENTIFY DEVICE, while for an ATA packet device it's IDENTIFY PACKET DEVICE. Different commands, same vibe check.
When this utility is invoked for an ATAPI device (e.g. a CD/DVD/BD drive with sg_inq /dev/hdc) then a SCSI INQUIRY is sent to the device, and if it responds then the response is decoded and output and this utility exits. Wanna see the response for an ATA IDENTIFY PACKET DEVICE command instead? Add the --ata option (e.g. sg_inq --ata /dev/hdc). Easy.
This utility doesn't decode the response to an ATA IDENTIFY (PACKET) DEVICE command β hdparm does a good job at that, so we let it have its moment. The -HHH option was added for use with either the --ata or --page=ai option to produce a format acceptable to hdparm --Istdin. Example time:
sg_inq --ata -HHH /dev/hdc | hdparm --Istdin
See hdparm. Collab of the century honestly π«Ά
π NVME DEVICES π
Currently these devices are typically SSDs (Solid State Disks) directly connected to a PCIe connector or via a specialized connector such as an M2 connector. Linux and FreeBSD treat NVMe storage devices as separate from SCSI storage, with device names like /dev/nvme0n1 (in Linux) and /dev/nvme0ns1 (in FreeBSD).
The NVM Express group has a document titled "NVM Express: SCSI Translation Reference" which defines a partial "SCSI to NVMe Translation Layer", often known by its acronym: SNTL. Hot acronym, no notes.
On operating systems where it's supported by this package, this utility will detect NVMe storage devices that are directly connected and send an Identify controller NVMe Admin command, then decode its response. A NVMe controller is architecturally similar to a SCSI target device. If the NVMe DEVICE indicates a namespace then an Identify namespace NVMe Admin command is sent to that namespace and its response is decoded. Namespaces are numbered sequentially starting from 1. Namespaces are similar to SCSI Logical Units, and their identifiers (nsid_s) can be thought of as SCSI LUNs. In the Linux and FreeBSD example device names above, the "n1" and the "ns1" parts indicate nsid 1. If no namespace is given in the DEVICE then all namespaces found in the controller get Identify namespace commands and the responses are decoded. Thorough queen π
Wanna get more details in the response? Use the --long option. Wanna only get the controller's Identify decoded? Use the --only option. Pick your fighter β¨
It's possible that even though the DEVICE presents as a NVMe device, it has a SNTL and accepts SCSI commands. Plot twist π In that case, to send a SCSI INQUIRY command (and fetch its VPD pages) use the sg_vpd(8) utility.
π§ SG_INQ and SG_VPD π§
Both these utilities have much in common since VPD pages are fetched with the SCSI INQUIRY command. As more VPD pages got added (and existing pages expanded), the newer ones were only decoded with sg_vpd. Recently, with the optional JSON output work, it was decided to place all VPD page decoding in a source file called sg_vpd_common.c that is linked in by both sg_inq and sg_vpd. Sharing is caring π
This means the VPD page decoding capabilities of both sg_inq and sg_vpd will be the same. Their default actions remain as they were, namely: when sg_inq is used without command line options, it decodes the "standard INQUIRY data format" (usually called the "standard INQUIRY response") response, while when sg_vpd is used without options, it decodes the "Supported VPD pages" VPD page. Same brain, different defaults π
β EXIT STATUS β
The exit status of sg_inq is 0 when it is successful. Otherwise, see the sg3_utils(8) man page. That's it, that's the rule π
OLDER COMMAND LINE OPTIONS π«Ά
Okay bestie, these are the OG options β the only ones that existed before sg3_utils version 1.23. Since then, this utility defaults to the newer command line options, which you can override by using --old (or -O) as the first option. And if you want another way to force these old-school options, peep the ENVIRONMENT VARIABLES section below. β¨
-36β only requests36bytes of response data for an INQUIRY. And like, even if the device says in its response that it can supply more data, a second (longer) INQUIRY is not performed. It's a paranoid setting, ngl. Equivalent to--len=36in the OPTIONS section.-aβ fetches the ATA Information VPD page [0x89]. Equivalent to--page=aiin the OPTIONS section. This page is defined in SAT (see atwww.t10.org).-Aβ assumes the given DEVICE is an ATA or ATAPI device. Equivalent to--atain the OPTIONS section.-bβ decodes the Block Limits VPD page [0xb0]. Equivalent to--page=blin the OPTIONS section. This page is defined in SBC-2 (seewww.t10.org) and later.-B=0|1β equivalent to--block=0|1in the OPTIONS section.-cβ sets the Command Support Data (CmdDt) bit (defaults to clear(0)). Used together with the-p=VPD_PGoption to specify the SCSI command opcode to query. Equivalent to--cmddtin the OPTIONS section.-clβ lists the command data for all supported commands (followed by the command name) by looping through all256opcodes. Heads up: this option uses the CmdDt bit which is now obsolete. See thesg_opcodes(8)utility. Equivalent to--cmddt --cmddtin the OPTIONS section.-dβ decodes depending on context. If the-eoption is given, or any option that implies-e(e.g.-ior-p=80), then this utility attempts to decode the indicated VPD page. Otherwise the version descriptors (if any) are listed following a standard INQUIRY response. In the version descriptors sense, equivalent to--descriptorsin the OPTIONS section.-eβ enables (i.e. sets) the Vital Product Data (EVPD) bit (defaults to clear(0)). Used together with the-p=VPD_PGoption to specify the VPD page to fetch. If-p=VPD_PGisn't given then VPD page0(list supported VPD pages) is assumed.-fβ Equivalent to--forcein the OPTIONS section.-hβ outputs the INQUIRY response in hex instead of trying to decode it. Equivalent to--hexin the OPTIONS section.-Hβ same action as-h. Equivalent to--hexin the OPTIONS section.-iβ decodes the Device Identification VPD page [0x83]. Equivalent to--idin the OPTIONS section. This page is made up of several "designation descriptors". If-his given then each descriptor header is decoded and the identifier itself is output in hex. To see the whole VPD0x83page response in hex use-p=83 -h.-I=FNβ equivalent to--inhex=FNin the OPTIONS section.-j[=JO]β equivalent to--json[=JO]in the OPTIONS section.-l=LENβ equivalent to--len=LENin the OPTIONS section.-Lβ equivalent to--longin the OPTIONS section.-mβ decodes the Management network addresses VPD page [0x85]. Equivalent to--page=mnain the OPTIONS section.-Mβ decodes the Mode page policy VPD page [0x87]. Equivalent to--page=mppin the OPTIONS section.-N,--newβ switch to the newer style options. β¨-oβ equivalent to--onlyin the OPTIONS section.-p=VPD_PGβ used together with the-eor-coption. If neither is given then the-eoption is assumed. When the-eoption is also given (or assumed) then the argument to this option is the VPD page number. The argument is interpreted as hexadecimal and is expected to be in the range0toffinclusive. Only VPD page0is decoded, and it lists supported VPD pages and their names (if known). To decode the mandatory device identification page (0x83) use the-ioption. A now obsolete usage is when the-coption is given, in which case the argument to this option is assumed to be a command opcode number. Recent SCSI draft standards have moved this facility to a separate command (seesg_opcodes(8)). Defaults to0so if-eis given without this option then VPD page0is output.-Pβ decodes the Unit Path Report VPD page [0xc0] which is EMC specific. Equivalent to--page=uprin the OPTIONS section.-rβ outputs the response in binary to stdout. Equivalent to--rawin the OPTIONS section. Can be used twice (i.e.-rr(and-HHHhas same effect)) and if used with the-Aor-aoption yields output with the same format ascat /proc/ide/hd<x>/identifyso that it can then be piped tohdparm --Istdin. π-sβ decodes the SCSI Ports VPD page [0x88]. Equivalent to--page=spin the OPTIONS section.-uβ equivalent to--exportin the OPTIONS section.-vβ increases level of verbosity. Can be used multiple times.-Vβ prints out version string then exits.-xβ decodes the Extended INQUIRY data VPD [0x86] page. Equivalent to--page=eiin the OPTIONS section.-?β outputs usage message and exits. Ignores all other parameters.
π EXAMPLES π
The examples on this page use Linux device names, bestie. For suitable device names on other supported Operating Systems, see the sg3_utils(8) man page.
To view the standard inquiry response, use it with no options:
sg_inq /dev/sda
Some SCSI devices include version descriptors indicating the various SCSI standards and drafts they support. You can view them with:
sg_inq -d /dev/sda
Modern SCSI devices include Vital Product Data (VPD) pages which can be viewed with the SCSI INQUIRY command. To list the supported VPD pages (but not their contents) try:
sg_inq -e /dev/sda
On 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 gives the same output as probing the device β with the added benefit that decoding those files doesn't need root permissions. π If /dev/sg3 is a disk at 2:0:0:0, then these three invocations should result in the same output:
sg_inq --raw --inhex=/sys/class/scsi_generic/sg3/device/vpd_pg83
sg_inq -rI /sys/class/scsi_generic/sg3/device/vpd_pg83
sg_inq -r -I /sys/class/scsi_disk/2:0:0:0/device/vpd_pg83
Without the --raw option, the --inhex=FN option would expect the contents of those files to be hexadecimal. vpd_pg83 contains the response (in binary) to the Device Identification VPD page whose page number is 83h (i.e. hexadecimal).
Some VPD pages can be read with the sg_inq utility, but a newer utility called sg_vpd specializes in showing their contents. The sdparm utility can also be used to show the contents of VPD pages. π¦
Further examples of sg_inq together with some typical output can be found on the https://sg.danny.cz/sg/sg3_utils.html web page.
πΈ ENVIRONMENT VARIABLES πΈ
Since sg3_utils version 1.23 the environment variable SG3_UTILS_OLD_OPTS can be given. When it's present, this utility will expect the older command line options. So the presence of this environment variable is equivalent to using --old (or -O) as the first command line option. β¨
π AUTHOR π
Written by Douglas Gilbert
π REPORTING BUGS π
Report bugs to <dgilbert at interlog dot com>.
π COPYRIGHT π
Copyright Β© 2001-2026 Douglas Gilbert
This software is distributed under the GPL version 2 or the BSD-2-Clause license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
π§ SEE ALSO π§
sg_opcodes(8), sg_vpd(8), sg_logs(8), sg_modes(8), sg_decode_sense(8), sdparm(8), hdparm(8), sgdiag(scsirastools)
And that's a wrap, bestie!! This lil masterpiece is sg3_utils-1.49, dated 2026-07-13, and it's the SG_INQ(8) page β go forth and INQUIRE responsibly π
β¨π«Ά
π¦ 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