SGINFO(8)
Okay bestie, meet sginfo π It's part of the sg3_utils crew and lives in manual section 8, so you know it's serious business π
β¨ NAME β¨
sginfo is the girl who gets you into a SCSI (or ATAPI) device's mode page information π
β¨ SYNOPSIS β¨
sginfo [OPTIONS] [DEVICE] [REPLACEMENT_PARAMETERS]
β¨ DESCRIPTION β¨
okay so sginfo is a port of the Linux scsiinfo program, made by Eric Youngdale π§ It talks through SCSI generic (sg) devices, but highkey it can also take the high level device names (sd, sr, st, osst, or hd) in some cases π¦ Its main job is reading mode page info, and if you're allowed, it can change that info too π₯ It also shows you stuff from the INQUIRY and READ DEFECTS commands β¨
ngl this utility is in legacy mode, so it only gets fixes for obvious bugs π Options like -l (to list devices) are broken in newer Linux versions (the 2.6 series and later), so use the lsscsi(8) utility instead π Also, the mode pages aren't kept up to date as https://www.t10.org adds and changes mode page fields. If you're into SCSI mode pages, the sdparm utility is more up to date and way easier to use, especially for changing parameters π
A SCSI device keeps four sets of values for each mode page π There's the current (active) values, the default (the ones the manufacturer supplied), the saved values (the ones kept when the SCSI device is powered down), and the changeable values (a mask showing which values can actually be changed) π By default, when you display a mode page you get the current values. You can switch that up with -M (defaults), -S (saved), or -m (modifiable, aka changeable) π
Lots of mode pages are decoded for you π Disks follow SBC-2, CD/DVDs follow MMC-2/3/4/5, tapes follow SSC-2, and enclosures follow SES-2 β¨ Some mode pages that every SCSI peripheral device type shares are defined in SPC-4 (the primary commands) π
A decoded mode page puts its field names in the first column and the matching value in the second column π¦ A hex mode page (or subpage) puts its byte position in the first column (in hex, starting at 0x2) and the matching hex value in the second column π You can view decoded pages with the -t option, or with a specific option (like c for the caching mode page) π Just remember decoded pages have to be supplied by the DEVICE and recognised by this program, obviously π If the device supports it, decoded pages can be modified too π₯ And every mode page (and subpage) the device supports can be viewed in hex (and potentially modified) with the -u option π«Ά
If you don't give any options that would print mode page(s) or INQUIRY data, you'll get a brief INQUIRY response instead πΈ That includes the vendor, product, and revision level of the device β¨
β¨ OPTIONS β¨
-6β Uses 6 byte MODE SENSE and MODE SELECT commands π By default, the 10 byte versions are used instead.-aβ Shows some INQUIRY data and the unit serial number, then every mode page the device reports π It's kinda like-t 0x3f. Known pages come out decoded, and anything else comes out in hexadecimal.-Aβ Shows some INQUIRY data and the unit serial number, then every mode page and every mode subpage the device reports π It's kinda like-t 0x3f,0xff. Known (sub)pages come out decoded, everything else comes out in hexadecimal.-cβ Gets you the info in the Caching mode page π§-Cβ Gets you the info in the Control mode page π¦-dβ Displays defect lists (default format: index) π-Dβ Gets you the info in the Disconnect-Reconnect mode page π-eβ Gets you the info in the Error Recovery mode page β¨-Eβ Gets you the info in the Control Extension mode page π-fβ Gets you the info in the Format Device mode page π-Fargβ Picks the format for defect lists π₯ Use it with-dor-G. If you don't give a format,indexis assumed.-Flogicalβ logical block addresses (32 bit) π-Flba64β logical block addresses (64 bit) π-Fphysicalβ physical blocks π-Findexβ defect bytes from index π-Fheadβ sort by head π
-gβ Gets you the info in the Rigid Disk Drive Geometry mode page π«Ά-Gβ Displays the grown defect list (default format: index) πΈ-iβ Displays the response to a standard INQUIRY command π-Iβ Gets you the Informational Exceptions mode page π-lβ Deprecated π Only use it on old versions of Linux (like 2.4 and earlier). For the Linux 2.6 series and later, please use lsscsi(8) instead. It lists the known SCSI devices on the system.-nβ Gets you the info in the Notch and Partition mode page π-Nβ Stops mode page changes from going into the "saved" page π By default, changes go to both the current and the saved page. This only works when you use it together with-R.-Pβ Gets you the info in the Power Condition mode page β-rβ Displays all the raw (or primary) SCSI device names in the/devdirectory π«Ά Examples are/dev/sda,/dev/st1, and/dev/scd2. It doesn't list sg device names, so devices like a SCSI enclosure that only have an sg device name won't show up π-sβ Displays info from the unit serial number page, which is a variant of the INQUIRY command π¦-t PN[,SPN]β Displays info from mode page numberPN(and optionally subpage numberSPN) in decoded format if it's known, or in hex otherwise πPNis a decimal mode page number from 0 to 63 inclusive.SPNis the mode subpage number, and it's assumed to be 0 if you don't give one.SPNis a decimal number from 1 to 255 inclusive. Page number 63 returns every page the device supports, in ascending order, except page 0, which (if it's there) goes last π Page 0 is vendor specific and isn't necessarily in mode page format π You can also give hex values for bothPNandSPN, as long as you prefix them with0xπ-Tβ Traces commands for more verbose output (great for debugging) π₯ Use it once and you'll see the SCSI commands (in hex), plus any errors from them spelled out with a decoded and raw sense buffer π§ Use it twice and you'll also see the extra data sent with mode select and the response from mode sense (in hex) π-u PN[,SPN]β Displays info from mode page numberPN(and optionallySPN) in hex form π«ΆPNis a decimal mode page number from 0 to 63 inclusive.SPNis the mode subpage number, and it's assumed to be 0 if you don't give one.SPNis a decimal number from 1 to 255 inclusive. Page number 63 returns every page the device supports, in ascending order, except page 0, which (if it's there) goes last πΈ Page 0 is vendor specific and isn't necessarily in mode page format β¨ You can give hex values for bothPNandSPNtoo, as long as they're prefixed with0x. For example,63and0x3fare equivalent π-vβ Displays the version string and then exits π [N.B. This option makes most other utilities in this package more verbose, as outlined inman 8 sg3_utils. This odd usage is there for backward compatibility with thescsiinfoutility.]-Vβ Gets you the info in the Verify Error Recovery mode page π [N.B. In most other utilities in this package this option prints the version string and then exits, as outlined inman 8 sg3_utils. This odd usage is there for backward compatibility with thescsiinfoutility.]-zβ Does a single fetch for mode pages, which over-estimates the length of the response you'll get back π§ The default is a double fetch: the first fetch finds the response length that could come back. Devices that stick closely to SCSI standards shouldn't need this option, but some real world devices do need it π₯Ί
β¨ GENERATING SCRIPT FILES AND HEX PAGES β¨
okay so if you want a script file π, use -aX or -AX. it spits out your mode pages as a list (after the INQUIRY and serial number), one page per line π
the cute part: every line gets prefixed with sginfo -t PN[,SPN] -XR . so when you run the script, it basically re-asserts the mode page values back to whatever they were when -aX made the output. main character energy for your device settings π
all the mode pages (and subpages) your device supports can be reached with -t and -u. wanna see every mode page? -u 63 πΈ and if you want every mode page AND every subpage, go with -u 63,255 β¨
to peek at the control mode page in hex π¦, use -u 0xa. you get the mode page index in the first column and the matching byte value in the second. mode pages (subpage code == 0) start at index position 2, and subpages start at index position 4 π§
if you add -Xu ..., you get a list of hex values, and each one is prefixed with @ π₯. then you can edit (sub)page values with -RXu ... π
π RESTRICTIONS π
ngl this part is a little dramatic. the SCSI MODE SENSE command gives you block descriptors and mode page(s). sginfo ignores the block descriptors and doesn't display them, so don't go looking for them π«Ά
the "disable block descriptor" switch (DBD) in the MODE SENSE command is not set, because some devices throw errors when it is set π
when you're changing mode page values (the -R option), the same block descriptor you got from reading the mode page (aka via a MODE SENSE command) gets sent back when the page is written (aka via a MODE SENSE... er, a MODE SELECT command) π
β οΈ bestie, don't skip this bit: that block descriptor has to ride along with the write. it's how the device knows what it's getting.
π REFERENCES π
SCSI (draft) standards live at https://www.t10.org π the ones you want are:
- SPC-4 β mode pages common to all device types π
- SBC-2 β direct access devices [e.g. disks] πΏ
- MMC-4 β CDs and DVDs π
- SSC-2 β tapes πΌ
π AUTHORS π
written by Eric Youngdale, Michael Weller, Douglas Gilbert, Kurt Garloff, and Thomas Steudten π«Ά
π HISTORY π
okay storytime π scsiinfo version 1.0 was released by Eric Youngdale on 1st November 1993. the most recent scsiinfo is version 1.7, with the last patches by Michael Weller β¨
sginfo is derived from scsiinfo and uses the sg interface to get around the 4 KB buffer limit in scsiinfo, which cramped the display of defect lists especially π sginfo was written by Douglas Gilbert with patches from Kurt Garloff π and this manpage corresponds with version 2.25 of sginfo πΈ
this software is distributed under the GPL version 2 π there is NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE π
π¦ SEE ALSO π¦
lsscsi(lsscsi),scsiinfo(internet)πsg_modes,sg_inq,sg_vpd(sg3_utils) π§sdparm(sdparm)β
bestie, that's the whole thing π₯Ή this page was from sg3_utils-1.38 (January 2014), and it's all about SGINFO(8) π go forth and reassert those mode pages like the legend you are πβ¨
π¦ where this page comes from
- alpine 3.24: sg3_utils-doc 1.48-r0 Β· BSD-2-Clause AND GPL-2.0-or-later
- arch rolling: sg3_utils 1.49-1 Β· GPL-2.0-or-later AND BSD-2-Clause
- centos-stream 10: sg3_utils 1.48-11.el10 Β· GPL-2.0-or-later AND BSD-2-Clause
- debian trixie: sg3-utils 1.48-3~deb13u1
- fedora 43: sg3_utils 1.48-10.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 43: sg3_utils 1.48-6.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-10.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-8.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- nixos 26.05: sg3_utils 1.48
- nixpkgs unstable: sg3_utils 1.49
- ubuntu questing: sg3-utils 1.48-2ubuntu1
- ubuntu resolute: sg3-utils 1.48-3ubuntu3
- ubuntu resolute: sg3-utils 1.48-3ubuntu3.2
- ubuntu stonking: sg3-utils 1.48-3ubuntu5
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms