![]() |
![]()
| ![]() |
![]()
NAMEsg_write_attr - send SCSI WRITE ATTRIBUTE command SYNOPSISsg_write_attr [--enumerate] [--element=EA] [--help] [--hex] [--in=FN] [--lvn=LVN] [--pn=PN] [--raw] [--wtc] [--verbose] [--version] DEVICE [attribute=value [attribute:value...]] DESCRIPTIONSends a SCSI WRITE ATTRIBUTE command to DEVICE among with attribute-value pairs specified in command line arguments or read from the input file. This command was introduced in SPC-3 revision 1 and thus is applicable to all SCSI devices. In practice it is used mainly for tape systems. This utility is based on the SPC-5 draft standard, revision 17 (spc5r17.pdf). OPTIONSArguments to long options are mandatory for short options as well.
Attribute-value pair formatAn attribute-value pair comprised of the attribute identifier and
attribute value, delimited by an equal sign '=' or a colon
':'. Attribute identifier can be specified as a number in decimal,
octal (prefixed by '0') or hexadecimal (prefixed by '0x') representation, or
with an acronym if the attribute provides one. Delimiter sign determines
value representation: an equal sign denotes values in string or numerical
format, or acronym, while a colon sign denotes a hex sequence comprised of
bytes in hexadecimal form separated by a space or comma.
NOTESOnly tape systems seem to implement the SCSI WRITE ATTRIBUTE
command. The vast majority of its definition is in the SPC standard so other
device types could use it.
EXAMPLESSet a tape barcode ASCII attribute specified by acronym and a string value: # sg_write_attr /dev/sg1 BarCode=BARCODE01 Set a tape barcode ASCII attribute specified by hexadecimal identifier and a string value: # sg_write_attr /dev/sg1 0x806=BARCODE01 Set a user label text attribute with string value containing spaces in quoted command line argument: # sg_write_attr /dev/sg1 "UserLabel=User label 1" Set a user label text attribute with hex sequence value: # sg_write_attr /dev/sg1
UserLabel:42,41,52,43,4F,44,45,30,32
Set a locale identifier attribute with values specified by acronyms or numbers: # sg_write_attr /dev/sg1 LocaleId=ascii
Set multiple attributes specified in command line arguments: # sg_write_attr /dev/sg1 BarCode=BARCODE01 "UserLabel=My User Label" LocaleId=iso-8859-1 Set variable-length binary attribute with values in numerical or hex sequence formats: # sg_write_attr /dev/sg1 VCI=1
Set fixed-length binary attribute using value in hex sequence format: # sg_write_attr /dev/sg1 "MediumGUID:63 38 66 36 62 39 32 32 2d 37 38 38 39 2d 31 31 65 64 2d 38 65 35 31 2d 66 37 36 65 62 32 63 39 38 38 64 31" Delete an attribute using empty value: # sg_write_attr /dev/sg1 BarCode=
Delete multiple attributes: # sg_write_attr /dev/sg1 UserLabel= BarCode= 0x805= Set attributes specified in the text input file: # sg_write_attr --in=attrs.txt /dev/sg1
Set attribute list specified in the hexadecimal format input file: # sg_write_attr --in=attrs_hex.txt --hex /dev/sg1
Set attribute list specified in the raw binary input file: # sg_write_attr --in=attrs_raw.bin --raw /dev/sg1
EXIT STATUSThe exit status of sg_write_attr is 0 when it is successful. Otherwise see the sg3_utils(8) man page. AUTHORSWritten by Douglas Gilbert and Boris Fox. REPORTING BUGSReport bugs to <dgilbert at interlog dot com>. COPYRIGHTCopyright © 2016-2020 Douglas Gilbert, 2022-2023 Boris Fox
SEE ALSOsg_read_attrs(sg3_utils)
|