SG_IDENT(8)

πŸ“¦
version 1.49 Β· 3 versions
, in alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ SG_IDENT(8) ✨

okay bestie, this is the manual page for sg_ident from sg3_utils πŸ’–

✨ NAME ✨

sg_ident - send SCSI REPORT/SET IDENTIFYING INFORMATION command πŸŽ€

✨ SYNOPSIS ✨

sg_ident [--ascii] [--clear] [--help] [--itype=IT] [--raw] [--set]
[--verbose] [--version] DEVICE

✨ DESCRIPTION ✨

okay so this tool sends a SCSI REPORT IDENTIFYING INFORMATION or SET IDENTIFYING INFORMATION command to DEVICE πŸ’… fun fact: before SPC-4 (revision 7), these were called REPORT DEVICE IDENTIFIER and SET DEVICE IDENTIFIER, so if you see the old names in older docs, it's the same vibe πŸ¦‹ SCSI devices that support these two commands let you write (set) some identifying info and then read it back later on ✨ and it's persistent, meaning it's stored on some non-volatile medium inside the device and survives a power outage πŸ’œ

ngl the space for this info is kinda small πŸ₯Ί SPC-4 (revision 7) says that for information type 0, the minimum length is 64 bytes and the maximum is 512 bytes. For other information types (1 to 126 inclusive), the maximum length is 256 bytes. Also, information types 1 to 126 (inclusive) should hold a null terminated UTF-8 string. The author has seen older disks that only support 16 bytes πŸ’€

when you run it with no options, it's giving "just peek at the info": it invokes the Report Identifying Information command with the information type defaulting to zero πŸ‘‘ error reports go to stderr πŸ™ˆ by default the info is shown in ASCII-HEX (up to 16 bytes per line) with an ASCII version on the right, where non printable characters become dots 🌸

✨ OPTIONS ✨

ok so arguments to long options are mandatory for short options too, no skipping that part bestie 🫢

  • -A, --ascii β€” runs the Report Identifying Information command, and if there's anything there, it interprets it as ASCII (or UTF-8, which depends on your locale) and prints it to stdout πŸ’–
  • -C, --clear β€” runs the Set Identifying Information command with an information length of zero, which basically wipes the existing info 🧹✨
  • -h, --help β€” prints the usage message and then exits 🌈
  • -i, --itype=IT β€” IT is the information type. It defaults to zero, and the max is 127. That one is special and can't be used with --set or --clear 🚫 if supported, information type 127 makes REPORT IDENTIFYING INFORMATION respond with a list of the available information types and their max lengths in bytes πŸ“‹ also, the odd numbered information types between 3 and 125 (inclusive) are off limits, because they clash with the SCC-2 standard πŸ’€
  • -r, --raw β€” runs the Report Identifying Information command, and if there's anything, sends it to stdout as-is (it might be binary, so be careful πŸ‘€). Nothing else goes to stdout, but error reports still go to stderr πŸ¦‹
  • -S, --set β€” first reads stdin until it detects an EOF, then runs the Set Identifying Information command to store whatever it grabbed from stdin as the info πŸ’… the amount of data has to be between 1 and 512 bytes (inclusive) πŸ“
  • -v, --verbose β€” increases the verbosity level, aka you get more debug output πŸ”
  • -V, --version β€” prints the version string and then exits πŸŽ€

this utility lets you write your own identifying info to your SCSI devices πŸ’– but there are a bunch of other descriptors (or designators) you can't change, no cap 😭 those include the SCSI INQUIRY command with its standard vendor and product identification strings and the product revision level, plus the huge amount of info in the "Device Identification" VPD page (see sg_vpd) 🧚 there's also the READ MEDIA SERIAL NUMBER command (see sg_rmsn) ✨ and the MMC-4 command set for CD and DVDs has a "media serial number" feature (0x109) [and a "logical unit serial number" feature] πŸ’Ώ you can view these with the sg_get_config utility 🌸

✨ EXAMPLES ✨

first up, to see if there's existing info whose format is unknown (for information type 0), just use no options πŸ‘€

# sg_ident /dev/sdb
 00     31 32 33 34 35 36 37 38  39 30          1234567890

if it's ASCII, you can print it as such πŸ’…

# sg_ident --ascii /dev/sdb
1234567890

you can copy the info to a file, clear it, and then re-assert it with this sequence 🫢

# sg_ident --raw /dev/sdb > t
# sg_ident --clear /dev/sdb
# cat t | sg_ident --set /dev/sdb

✨ EXIT STATUS ✨

the exit status of sg_ident is 0 when it's successful 🌈 otherwise, check out the sg3_utils(8) man page πŸ“–

✨ AUTHORS ✨

written by Douglas Gilbert πŸ‘‘

✨ REPORTING BUGS ✨

report bugs to <dgilbert at interlog dot com> πŸ’Œ

Copyright Β© 2005-2018 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 πŸ™ˆ

✨ SEE ALSO ✨

sg_vpd(sg3_utils), sg_rmsn(sg3_utils), sg_get_config(sg3_utils) πŸ¦‹


bestie, you're officially a SCSI identity expert now πŸŒˆπŸ’– this page was from sg3_utils-1.43, August 2018, and you're literally the main character βœ¨πŸ‘‘

πŸ“¦ where this page comes from