1SG_REQUESTS(8) SG3_UTILS SG_REQUESTS(8)
2
3
4
6 sg_requests - send one or more SCSI REQUEST SENSE commands
7
9 sg_requests [--desc] [--help] [--hex] [--maxlen=LEN] [--num=NUM]
10 [--progress] [--raw] [--status] [--time] [--verbose] [--version] DEVICE
11
13 Send SCSI REQUEST SENSE command to DEVICE and output the parameter data
14 response which is expected to be in sense data format. Both fixed and
15 descriptor sense data formats are supported.
16
17 Multiple REQUEST SENSE commands can be sent with the --num=NUM option.
18 This can be used for timing purposes or monitoring the progress indica‐
19 tion.
20
22 Arguments to long options are mandatory for short options as well.
23
24 -d, --desc
25 sets the DESC bit in the REQUEST SENSE SCSI cdb. The DEVICE
26 should return sense data in descriptor (rather than fixed) for‐
27 mat. This will only occur if the DEVICE recognizes descriptor
28 format (SPC-3 and later). If the device is pre SPC-3 then set‐
29 ting a bit in a reserved field may cause a check condition sta‐
30 tus with an illegal request sense key, but will most likely be
31 ignored.
32
33 -h, --help
34 output the usage message then exit.
35
36 -H, --hex
37 output response in ASCII hexadecimal.
38
39 -m, --maxlen=LEN
40 where LEN is the (maximum) response length in bytes. It is
41 placed in the cdb's "allocation length" field. If not given (or
42 LEN is zero) then 252 is used. The maximum value of LEN is 255
43 (but SPC-4 recommends 252).
44
45 -n, --num=NUM
46 perform NUM SCSI REQUEST SENSE commands, stopping when either
47 NUM is reached or an error occurs. The default value for NUM is
48 1 .
49
50 -p, --progress
51 show progress indication (a percentage) if available. If
52 --num=NUM is given, NUM is greater than 1 and an initial
53 progress indication was detected then this utility waits 30 sec‐
54 onds before subsequent checks. Exits when NUM is reached or
55 there are no more progress indications. Ignores --hex, --raw
56 and --time options. See NOTES section below.
57
58 -r, --raw
59 output response in binary (to stdout).
60
61 -s, --status
62 if the REQUEST SENSE command finished without error (as indi‐
63 cated by its SCSI status) then the contents of the parameter
64 data are analysed as sense data and the exit status is set
65 accordingly. The default action (i.e. when this option is not
66 given) is to ignore the contents of the parameter data for the
67 purposes of setting the exit status. Some types of error set a
68 sense key of "NO SENSE" with non-zero information in the addi‐
69 tional sense code (e.g. the FAILURE PREDICTION THRESHOLD
70 EXCEEDED group of codes); this results in an exit status value
71 of 10. If the sense key is "NO SENSE" and both asc and ascq are
72 zero then the exit status is set to 0 . See the sg3_utils(8) man
73 page for exit status values.
74
75 -t, --time
76 time the SCSI REQUEST SENSE command(s) and calculate the average
77 number of operations per second.
78
79 -v, --verbose
80 increase the level of verbosity, (i.e. debug output). Addition‐
81 ally the response (if received) is output in ASCII-HEX. Use this
82 option multiple times for greater verbosity.
83
84 -V, --version
85 print the version string and then exit.
86
88 In SCSI 1 and 2 the REQUEST SENSE command was very important for error
89 and warning processing in SCSI. The autosense capability rendered this
90 command almost superfluous.
91
92 However recent SCSI drafts (e.g. SPC-4 rev 14 and SBC-3 rev 14)
93 increase the utility of the REQUEST SENSE command. Idle and standby
94 (low) power conditions can be detected with this command.
95
96 The REQUEST SENSE command is not marked as mandatory in SPC-3 (i.e. for
97 all SCSI devices) but is marked as mandatory in SBC-2 (i.e. for disks),
98 SSC-3 (i.e. for tapes) and MMC-4 (i.e. for CD/DVD/HD-DVD/BD drives).
99
100 The progress indication is optionally part of the sense data. When a
101 prior command that takes a long time to complete (and typically pre‐
102 cludes other media access commands) is still underway, the progress
103 indication can be used to determine how long before the device returns
104 to its normal state.
105
106 The SCSI FORMAT command for disks used with the IMMED bit set is an
107 example of an operation that takes a significant amount of time and
108 precludes other media access during that time. The IMMED bit set
109 instructs the FORMAT command to return control to the application
110 client once the format has commenced (see SBC-3). Several long duration
111 SCSI commands associated with tape drives also use the progress indica‐
112 tion (see SSC-3).
113
114 Early standards suggested that the SCSI TEST UNIT READY command be used
115 for polling the progress indication. More recent standards seem to sug‐
116 gest the SCSI REQUEST SENSE command should be used instead.
117
119 The exit status of sg_requests is 0 when it is successful. Otherwise
120 see the sg3_utils(8) man page.
121
123 Written by Douglas Gilbert.
124
126 Report bugs to <dgilbert at interlog dot com>.
127
129 Copyright © 2004-2012 Douglas Gilbert
130 This software is distributed under a FreeBSD license. There is NO war‐
131 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
132 POSE.
133
135 sg3_utils
136
137
138
139sg3_utils-1.35 December 2012 SG_REQUESTS(8)