OS Manuals

/usr/bin/sg_read_attr

SCSI utilities for Linux, Unix and Windows

From sg3-utils 1.49-r3 (enterprise-packages), captured 2026-11-08 by running sg_read_attr --help (exit 0). permalink

Usage: sg_read_attr [--cache] [--element=EA] [--enumerate] [--filter=FL]
                    [--first=FAI] [--help] [--hex] [--in=FN] [--lvn=LVN]
                    [--maxlen=LEN] [--partition=PN] [--quiet] [--raw]
                    [--readonly] [--sa=SA] [--verbose] [--version]
                    DEVICE
  where:
    --cache|-c         set CACHE bit in cdn (def: clear)
    --enumerate|-e     enumerate known attributes and service actions
    --element=EA|-E EA    EA is placed in 'element address' field in
                          cdb [SMC-3] (def: 0)
    --filter=FL|-f FL    FL is parameter code to match (def: -1 -> all)
    --first=FAI|-F FAI    FAI is placed in 'first attribute identifier'
                          field in cdb (def: 0)
    --help|-h          print out usage message
    --hex|-H           output response in hexadecimal; used twice
                       shows decoded values in hex
    --in=FN|-i FN      FN is a filename containing attribute values in
                       ASCII hex or binary if --raw also given
    --lvn=LVN|-l LVN    logical volume number (LVN) (def:0)
    --maxlen=LEN|-m LEN    max response length (allocation length in cdb)
                           (def: 0 -> 8192 bytes)
    --partition=PN|-p PN    partition number (PN) (def:0)
    --quiet|-q         reduce the amount of output, can use more than once
    --raw|-r           output response in binary
    --readonly|-R      open DEVICE read-only (def: read-write)
    --sa=SA|-s SA      SA is service action (def: 0)
    --verbose|-v       increase verbosity
    --version|-V       print version string and exit

Performs a SCSI READ ATTRIBUTE command. Even though it is defined in
SPC-3 and later it is typically used on tape systems.
Options (19)
OptionDescriptionSource
--element EA|-EEA is placed in 'element address' field in cdb [SMC-3] (def: 0)help
--filter, -f FL|-fwhere FL is an attribute identifier in the range 0 to 65535 or -1.help + man
--first, -F FAI|-FFAI is placed in 'first attribute identifier' field in cdb (def: 0)help + man
--in, -i FN|-iFN is treated as a file name (or '-' for stdin) which contains ASCII hexadecimal or binary representing the response to a READ ATTRIBUTE command with service action 0x0 (i.e (fetch) attribute values).help + man
--lvn, -l LVN|-lwhere LVN is placed in the "logical volume number" field of the cdb.help + man
--maxlen, -m LEN|-mmax response length (allocation length in cdb) (def: 0 -> 8192 bytes)help + man
--partition PN|-ppartition number (PN) (def:0)help
--sa, -s SA|-swhere SA is placed on the "service action" field of the cdb.help + man
-c, --cachesets the CACHE bit in the READ ATTRIBUTE cdb. (in the manual page but not in --help)man
-e, --enumerateenumerates all known attributes and service actions. (in the manual page but not in --help)man
-E, --ea EAwhere EA is an element address which is placed in the READ ATTRIBUTE cdb. (in the manual page but not in --help)man
-h, --helpoutput the usage message then exit. (in the manual page but not in --help)man
-H, --hexoutput the response in hexadecimal to stdout. (in the manual page but not in --help)man
-p, --pn PNwhere PN is placed in the "partition number" field of the cdb. (in the manual page but not in --help)man
-q, --quietthis option reduces the amount of information output. (in the manual page but not in --help)man
-r, --rawoutput the SCSI response (i.e. the data-out buffer) in binary (to stdout). (in the manual page but not in --help)man
-R, --readonlyopen the DEVICE read-only (e.g. in Unix with the O_RDONLY flag). (in the manual page but not in --help)man
-v, --verboseincrease the level of verbosity, (i.e. debug output). (in the manual page but not in --help)man
-V, --versionprint the version string and then exit. (in the manual page but not in --help)man
Exit status (1) from the manual page
0it is successful

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.