~ubuntu-branches/ubuntu/dapper/sg3-utils/dapper-backports

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
.TH SG_LOGS "8" "June 2006" "sg3_utils-1.21" SG3_UTILS
.SH NAME
sg_logs \- read SCSI device log pages
.SH SYNOPSIS
.B sg_logs
[\fI-a\fR] [\fI-A\fR] [\fI-c=<page_control>\fR] [\fI-h\fR] [\fI-H\fR]
[\fI-l\fR] [\fI-L\fR] [\fI-p=<page_code>[,<subpage_code]\fR]
[\fI-paramp=<parameter_pointer>\fR] [\fI-pcb\fR] [\fI-ppc\fR] [\fI-r\fR]
[\fI-scum\fR] [\fI-sp\fR] [\fI-sthr\fR] [\fI-t\fR] [\fI-T\fR] [\fI-v\fR]
[\fI-V\fR] [\fI-?\fR] \fI<scsi_device>\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
This utility sends a LOG SENSE SCSI command to the given device and then
outputs the response. This is used in most cases to fetch log pages
stored on the given device and known log pages are decoded and output
in ASCII. In some cases a LOG SELECT SCSI command is issued to reset
parameters back to the device manufacturer's default values.
.PP
In SPC-4 revision 5 a subpage code was introduced to both the LOG
SENSE and LOG SELECT command. At the same time a page code field was
introduced to the to the LOG SELECT command. The log subpage code
can range from 0 to ff (255) inclusive. The subpage code value 'ff'
can be thought of as a wildcard.
.PP
Options with arguments or with two or more letters can have an extra '-'
prepended. For example: both '-pcb' and '--pcb' are acceptable.
.TP
-a
outputs all the log pages supported by the device. This requires
a two stage process: first the supported log pages log page is
fetched, then for each entry in the response, the corresponding
log page is fetched and displayed.
.TP
-A
outputs all the log pages and subpages supported by the device. This
requires a two stage process: first the supported log pages and subpages
log page is fetched, then for each entry in the response, the corresponding
log page is fetched and displayed.
.TP
-c=page_control
accepts 0, 1, 2 or 3 as an argument. 0 for current threshold values,
1 for current cumulative values, 2 for default threshold values and 3
for default cumulative values. The default is 1 (i.e. current threshold
values).
.TP
-h
suppresses decoding of known log sense pages and prints out the
response in hex instead.
.TP
-H
same action as '-h'.
.TP
-l
lists the names of all logs sense pages supported by this device.
See the list of common log page codes below.
.TP
-L
lists the names of all logs sense pages and subpages supported by this
device.  See the list of common log page codes below.
.TP
-p=<page_code>
log page code to access. Should be a hexadecimal number between 0 and 3f
inclusive. Commonly accessed log pages are listed below.
.TP
-p=<page_code>,<subpage_code>
log page code and subpage code to access. The page code should be a
hexadecimal number between 0 and 3f inclusive. The subpage code should be
a hexadecimal number between 0 and ff inclusive. The subpage code of 'ff'
can be thought of as a wildcard.
.TP
-paramp=<parameter_pointer>
parameter pointer value (in hex) to place in command. Should be a number
between 0 and ffff inclusive. 
.TP
-pcb
show Parameter Control Byte settings (only relevant when log parameters
being output in ASCII).
.TP
-ppc
sets the Parameter Pointer Control (PPC) bit. Default is 0 (i.e. cleared).
.TP
-r
use LOG SELECT SCSI command (PCR bit) to reset the given page or all pages
to the implemented parameter values to be the device defined (i.e.
manufacturer's) default values. In most cases the default values are zeroes.
This option seems to clear error counter log pages but leaves pages like
self-test results, start-stop cycle counter and temperature log pages
unaffected. This option may be required to clear log pages if a counter
reaches its maximum value since the log page in which the counter is found
will remain "stuck" until something is done. Most other options are ignored.
Prior to SPC-4 revision 5 the LOG SELECT command did not take a page
code (or a subpage code).
.TP
-scum
sets all (or specified log page) cumulative parameters to their default
values. Uses LOG SELECT SCSI command with pc=3 .
.TP
-sp
sets the Saving Parameters (SP) bit. Default is 0 (i.e. cleared). When
set this instructs the device to store the current log page 
parameters (as indicated by the DS and TSD parameter codes) in some
non-volatile location. Hence the log parameters will be preserved
across power cycles. This option is typically not needed, especially
if the GLTSD flag is clear in the control mode page as this instructs
the device to periodically save all saveable log parameters to
non-volatile locations.
.TP
-sthr
sets all (or specified log page) current threshold parameters to the default
threshold values.  Uses LOG SELECT SCSI command with pc=2 .
.TP
-t
outputs the temperature. First looks in the temperature log page and if
that is not available tries the Informational Exceptions page which may also
have the current temperature (especially in older disks).
.TP
-T
outputs the transport ('Protocol specific port') log page. Equivalent
to setting '-p=18'.
.TP
-v
verbose: show SCSI command blocks prior to execution.  '-vv'
and '-vvv' are also accepted yielding greater verbosity.
.TP
-V
print out version string
.TP
-?
output usage message. Ignore all other parameters.
.PP
Various log pages hold information error rates, device temperature,
start stop cycles since device produced and the results of the last
20 self tests. Self tests can be initiated by the sg_senddiag utility.
The smartmontools package provides much of the information found with
sg_logs in a form suitable for monitoring the health of SCSI disks and
tape drives.
.PP
Here is a list of log pages that are decoded by this utility. [Drop
the "0x" prefix when using them as an argument to the '-p=' option]:
.PP
0x0     Supported log pages
.br
0x1     Buffer overrun/underrun
.br
0x2     Write error counter
.br
0x3     Read error counter
.br
0x4     Read reverse error counter
.br
0x5     Verify error counter
.br
0x6     Non-medium error
.br
0x7     Last n error events
.br
0x8     Format status (sbc-2)
.br
0xb     Last n deferred errors or asynchronous events
.br
0xc     Sequential access device (ssc-2)
.br
0xd     Temperature
.br
0xe     Start-stop cycle counter
.br
0x10    Self-test results
.br
0x15    Background scan results (sbc-3)
.br
0x17    Non-volatile cache (sbc-3)
.br
0x18    Protocol specific port (SAS transport)
.br
0x2f    Informational exceptions
.br
0x37    Seagate cache (vendor, disk)
.br
0x3e    Seagate factory (vendor, disk)
.PP
In the 2.4 series of Linux kernels the given device must be
a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
and SCSI DVDs) can also be specified. For example "sg_logs -a /dev/sda"
will work in the 2.6 series kernels.
.SH EXIT STATUS
The exit status of sg_logs is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2002-2006 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B smartctl(smartmontools: see net), sg_senddiag(sg3_utils)