1SG_LOGS(8) SG3_UTILS SG_LOGS(8)
2
3
4
6 sg_logs - access log pages with SCSI LOG SENSE command
7
9 sg_logs [--all] [--control=PC] [--help] [--hex] [--list] [--maxlen=LEN]
10 [--name] [--page=PG[,SPG]] [--paramp=PP] [--pcb] [--ppc] [--raw]
11 [--reset] [--select] [--sp] [--temperature] [--transport] [--verbose]
12 [--version] DEVICE
13
14 sg_logs [-a] [-A] [-c=PC] [-h] [-H] [-l] [-L] [-m=LEN] [-n]
15 [-p=PG[,SPG]] [-paramp=PP] [-pcb] [-ppc] [-r] [-select] [-sp] [-t] [-T]
16 [-v] [-V] [-?] DEVICE
17
19 This utility sends a SCSI LOG SENSE command to the DEVICE and then out‐
20 puts the response. The LOG SENSE command is used to fetch log pages.
21 Known log pages are decoded by default. When the --reset and/or
22 --select option is given then a SCSI LOG SELECT command is issued to
23 reset parameters.
24
25 In SPC-4 revision 5 a subpage code was introduced to both the LOG SENSE
26 and LOG SELECT command. At the same time a page code field was intro‐
27 duced to the to the LOG SELECT command. The log subpage code can range
28 from 0 to 255 (0xff) inclusive. The subpage code value 255 can be
29 thought of as a wildcard.
30
31 This utility supports two command line syntaxes, the preferred one is
32 shown first in the synopsis and explained in this section. A later sec‐
33 tion on the old command line syntax outlines the second group of
34 options.
35
37 Arguments to long options are mandatory for short options as well.
38
39 -a, --all
40 outputs all the log pages supported by the device. This requires
41 a two stage process: first the "supported log pages" log page is
42 fetched, then for each entry in the response, the corresponding
43 log page is fetched and displayed. When used twice (e.g. '-aa')
44 all log pages and subpages are fetched.
45
46 -c, --control=PC
47 accepts 0, 1, 2 or 3 for the PC argument. 0 for current thresh‐
48 old values, 1 for current cumulative values, 2 for default
49 threshold values and 3 for default cumulative values. The
50 default is 1 (i.e. current threshold values).
51
52 -h, --help
53 print out the usage message then exit.
54
55 -H, --hex
56 The default action is to decode known mode page numbers (and
57 subpage numbers) into text. When this option is used once, the
58 response is output in hexadecimal.
59
60 -l, --list
61 lists the names of all logs sense pages supported by this
62 device. This is done by reading the "supported log pages" log
63 page. When used twice (e.g. '-ll') lists the names of all logs
64 sense pages and subpages supported by this device. There is a
65 list of common log page codes below.
66
67 -m, --maxlen=LEN
68 sets the "allocation length" field in the LOG SENSE cdb. The is
69 the maximum length in bytes that the response will be. Without
70 this option (or LEN equal to 0) this utility first fetches the 4
71 byte response then does a second access with the length indi‐
72 cated in the first (4 byte) response. Responses can be quite
73 large (e.g. the background scan results log page) and this
74 option can be used to limit the amount of information returned.
75
76 -n, --name
77 decode some log pages into 'name=value' entries, one per line.
78 The name contains no space and may be abbreviated and the value
79 is decimal unless prefixed by '0x'. Nesting is indicated by
80 leading spaces. This form is meant to be relatively easy to
81 parse.
82
83 -O, --old
84 switch to older style options.
85
86 -p, --page=PG[,SPG]
87 log page code to access. PG is expected to be a decimal number
88 between 0 and 63 inclusive. A hexadecimal number can be speci‐
89 fied by a leading "0x" or a trailing "h". Common log page codes
90 are listed below. Optionally SPG, a subpage code, can be given.
91 SPG is expected to be a decimal number between 0 and 255 inclu‐
92 sive.
93
94 -P, --paramp=PP
95 PP is the parameter pointer value to place in a field of that
96 name in the LOG SENSE cdb. A decimal number in the range 0 to
97 65535 (0xffff) is expected. When a value greater than 0 is given
98 the --ppc option should be selected. The default value is 0.
99
100 -q, --pcb
101 show Parameter Control Byte settings (only relevant when log
102 parameters being output in ASCII).
103
104 -Q, --ppc
105 sets the Parameter Pointer Control (PPC) bit in the LOG SENSE
106 cdb. Default is 0 (i.e. cleared).
107
108 -r, --raw
109 output the response in binary to stdout. Error messages and
110 warnings are output to stderr.
111
112 -R, --reset
113 use SCSI LOG SELECT command (PCR bit set) to reset the all log
114 pages (or the given page). [SPC-4 (rev 6) doesn't say that a
115 given log (sub)page can be reset yet.] Exactly what is reset
116 depends on the accompanying SP bit (i.e. --sp option which
117 defaults to 0) and the PC ("page control") value (which defaults
118 to 1). Supplying this option implies the --select option as
119 well. This option seems to clear error counter log pages but
120 leaves pages like self-test results, start-stop cycle counter
121 and temperature log pages unaffected. This option may be
122 required to clear log pages if a counter reaches its maximum
123 value since the log page in which the counter is found will
124 remain "stuck" until something is done.
125
126 -S, --select
127 use a LOG SELECT command. The default action (i.e. when neither
128 this option nor --reset is given) is to do a LOG SENSE command.
129 When this option is given, the SP bit (i.e. --sp option which
130 defaults to 0), the PC ("page control") value (which defaults to
131 1) and the PCR bit (i.e. --reset option which defaults to 0)
132 are placed in the LOG SELECT cdb. At some stage the log page and
133 subpage options may also be active [but SPC-4 (rev 6) doesn't
134 say that].
135
136 -s, --sp
137 sets the Saving Parameters (SP) bit. Default is 0 (i.e.
138 cleared). When set this instructs the device to store the cur‐
139 rent log page parameters (as indicated by the DS and TSD parame‐
140 ter codes) in some non-volatile location. Hence the log parame‐
141 ters will be preserved across power cycles. This option is typi‐
142 cally not needed, especially if the GLTSD flag is clear in the
143 control mode page as this instructs the device to periodically
144 save all saveable log parameters to non-volatile locations.
145
146 -t, --temperature
147 outputs the temperature. First looks in the temperature log page
148 and if that is not available tries the Informational Exceptions
149 log page which may also have the current temperature (especially
150 on older disks).
151
152 -T, --transport
153 outputs the transport ('Protocol specific port') log page.
154 Equivalent to setting '--page=18h'.
155
156 -v, --verbose
157 increase level of verbosity.
158
159 -V, --version
160 print out version string then exit.
161
163 Various log pages hold information error rates, device temperature,
164 start stop cycles since device produced and the results of the last 20
165 self tests. Self tests can be initiated by the sg_senddiag utility.
166 The smartmontools package provides much of the information found with
167 sg_logs in a form suitable for monitoring the health of SCSI disks and
168 tape drives.
169
170 Here is a list of log pages that are decoded by this utility. [The code
171 values can be given to '--page=' as is, with a trailing "h" instead of
172 the leading "0x", or as their decimal equivalents.]:
173
174 0x0 Supported log pages
175 0x0,0xff Supported log pages and subpages
176 0x1 Buffer overrun/underrun
177 0x2 Write error counter
178 0x3 Read error counter
179 0x4 Read reverse error counter
180 0x5 Verify error counter
181 0x6 Non-medium error
182 0x7 Last n error events
183 0x8 Format status (sbc-2)
184 0xb Last n deferred errors or asynchronous events
185 0xc Sequential access device (ssc-2)
186 0xd Temperature
187 0xe Start-stop cycle counter
188 0x10 Self-test results
189 0x15 Background scan results (sbc-3)
190 0x17 Non-volatile cache (sbc-3)
191 0x18 Protocol specific port (SAS transport)
192 0x2f Informational exceptions
193 0x37 Seagate cache (vendor, disk)
194 0x3e Seagate factory (vendor, disk)
195
196 In the 2.4 series of Linux kernels the DEVICE must be a SCSI generic
197 (sg) device. In the 2.6 series block devices (e.g. SCSI disks and DVD
198 drives) can also be specified. For example "sg_logs -a /dev/sda" will
199 work in the 2.6 series kernels.
200
202 The exit status of sg_modes is 0 when it is successful. Otherwise see
203 the sg3_utils(8) man page.
204
206 The options in this section were the only ones available prior to
207 sg3_utils version 1.23 . In sg3_utils version 1.23 and later these
208 older options can be selected by either setting the SG3_UTILS_OLD_OPTS
209 environment variable or using '--old' (or '-O) as the first option.
210
211 Options with arguments or with two or more letters can have an extra
212 '-' prepended. For example: both '-pcb' and '--pcb' are acceptable.
213
214 -a outputs all the log pages supported by the device. Equivalent
215 to --all in the main description.
216
217 -A outputs all the log pages and subpages supported by the device.
218 Equivalent to '--all --all' in the main description.
219
220 -c=PC Equivalent to --control=PC in the main description.
221
222 -h suppresses decoding of known log sense pages and prints out the
223 response in hex instead.
224
225 -H same action as '-h' in this section and equivalent to --hex in
226 the main description.
227
228 -l lists the names of all logs sense pages supported by this
229 device. Equivalent to --list in the main description.
230
231 -L lists the names of all logs sense pages and subpages supported
232 by this device. Equivalent to '--list --list' in the main
233 description.
234
235 -m=LEN request only LEN bytes of response data. Default is 0 which is
236 interpreted as all that is available. LEN is decimal unless it
237 has a leading '0x' or trailing 'h'. Equivalent to --maxlen=LEN
238 in the main description.
239
240 -n Equivalent to --name in the main description.
241
242 -N switch to the newer style options.
243
244 -p=PG[,SPG]
245 PG is the log page code to access. Should be a hexadecimal num‐
246 ber between 0 and 3f inclusive. If given SPG is the log subpage
247 code. SPG should be a hexadecimal number between 0 and ff
248 inclusive. The subpage code of 'ff' can be thought of as a wild‐
249 card.
250
251 -paramp=PP
252 PP is the parameter pointer value (in hex) to place in command.
253 Should be a number between 0 and ffff inclusive.
254
255 -pcb show Parameter Control Byte settings (only relevant when log
256 parameters being output in ASCII).
257
258 -ppc sets the Parameter Pointer Control (PPC) bit. Default is 0 (i.e.
259 cleared).
260
261 -r use SCSI LOG SELECT command (PCR bit set) to reset the all log
262 pages (or the given page). Equivalent to --reset in the main
263 description.
264
265 -select
266 use a LOG SELECT command. Equivalent to --select in the main
267 description.
268
269 -sp sets the Saving Parameters (SP) bit. Default is 0 (i.e.
270 cleared). Equivalent to --sp in the main description.
271
272 -t outputs the temperature. Equivalent to --temperature in the main
273 description.
274
275 -T outputs the transport ('Protocol specific port') log page.
276 Equivalent to --transport in the main description.
277
278 -v increase level of verbosity.
279
280 -V print out version string then exit.
281
282 -? output usage message then exit.
283
285 Written by Doug Gilbert
286
288 Report bugs to <dgilbert at interlog dot com>.
289
291 Copyright © 2002-2007 Douglas Gilbert
292 This software is distributed under the GPL version 2. There is NO war‐
293 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
294 POSE.
295
297 smartctl(smartmontools), sg_senddiag(sg3_utils)
298
299
300
301sg3_utils-1.23 January 2007 SG_LOGS(8)