SG_IDENT(8) | SG3_UTILS | SG_IDENT(8) |
sg_ident - send SCSI REPORT/SET IDENTIFYING INFORMATION command
sg_ident [--ascii] [--clear] [--help] [--itype=IT] [--raw] [--set] [--verbose] [--version] DEVICE
Send a SCSI REPORT IDENTIFYING INFORMATION or SET IDENTIFYING INFORMATION command to DEVICE. Prior to SPC-4 (revision 7) these commands were called REPORT DEVICE IDENTIFIER and SET DEVICE IDENTIFIER respectively. SCSI devices that support these two commands allow users to write (set) identifying information and report it back at some later time. The information is persistent (i.e. stored on some non-volatile medium within the SCSI device that will survive a power outage).
Typically the space allocated for the information is limited: SPC-4 (revision 7) states 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 contain a null terminated UTF-8 string. The author has seen older disks that only support 16 bytes.
The default action when no options are given is to invoke the Report Identifying Information command with the information type defaulting to zero. Error reports are sent to stderr. By default the information is shown in ASCII-HEX (up to 16 bytes per line) with an ASCII representation to the right with dots replacing non printable characters.
Arguments to long options are mandatory for short options as well.
This utility permits users to write their own identifying information to their SCSI devices. There are several other types of descriptors (or designators) that the user cannot change. These include the SCSI INQUIRY command with its standard vendor and product identification strings and the product revision level; plus the large amount of information provided by the "Device Identification" VPD page (see sg_vpd). There is also the READ MEDIA SERIAL NUMBER command (see sg_rmsn). The MMC-4 command set for CD and DVDs has a "media serial number" feature (0x109) [and a "logical unit serial number" feature]. These can be viewed with the sg_get_config utility.
First, to see if there is an existing information whose format is unknown (for information type 0), use no options:
# sg_ident /dev/sdb
00 31 32 33 34 35 36 37 38 39 30 1234567890
If it is ASCII then it can printed as such:
# sg_ident --ascii /dev/sdb
1234567890
The information can be copied to a file, cleared and then re-asserted with this sequence:
# sg_ident --raw /dev/sdb > t
# sg_ident --clear /dev/sdb
# cat t | sg_ident --set /dev/sdb
The exit status of sg_ident is 0 when it is successful. Otherwise see the sg3_utils(8) man page.
Written by Douglas Gilbert.
Report bugs to <dgilbert at interlog dot com>.
Copyright © 2005-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_vpd(sg3_utils), sg_rmsn(sg3_utils), sg_get_config(sg3_utils)
August 2018 | sg3_utils-1.43 |