~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
.TH SG_SES "8" "June 2006" "sg3_utils-1.21" SG3_UTILS
.SH NAME
sg_ses \- send controls and fetch status from a SCSI Enclosure
Services (SES) device
.SH SYNOPSIS
.B sg_ses
[\fI--byte1=<n>\fR] [\fI--control\fR] [\fI--data=<h>,<h>...\fR]
[\fI--filter\fR] [\fI--help\fR] [\fI--hex\fR] [\fI--inner-hex\fR]
[\fI--list\fR] [\fI--page=<page_code>\fR] [\fI--raw\fR]
[\fI--status\fR] [\fI--verbose\fR] [\fI--version\fR] \fI<scsi_device>\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
Send controls to a SES device (via a SCSI SEND DIAGNOSTIC command)
or fetches status (via a SCSI RECEIVE DIAGNOSTIC RESULTS command).
The given <scsi_device> should be a SES device which may be a dedicated
enclosure services processor (INQUIRY peripheral device type 0xd) or
attached to another type of SCSI device (e.g. a disk) in which case
the EncServ bit set in its INQUIRY response.
.PP
If no options are given (only the <scsi_device> name) then all
diagnostic pages supported by the device (including SES pages)
are listed.
.TP
--byte=<n> | -b <n>
some control pages need byte 1 (i.e. the second byte) of the cdb set.
Only required in rare cases when the '--control' option is also set.
Default is 0; <n> is in decimal unless it is prefixed by '0x'
or '0X' (or has a trailing 'h' or 'H').
.TP
--control | -c
will send control information to the given device via a SCSI SEND
DIAGNOSTIC command. Cannot give both this option and '--status'.
The Enclosure control, String Out, Threshold Out, Array control (obsolete
in SES-2) and Subenclosure String Out diagnostic pages can be set currently.
.TP
--data=<h>,<h>... | -d <h>,<h>...
permits a string of comma separated (ASCII) hex digits to be 
specified (limit 512). This allows the parameters to a control diagnostic
page to be specified. The string given should not include the first 4
bytes (i.e. page code and length). See next entry for using stdin.
.TP
--data=- | -d -
reads a data string from stdin. Spaces, tabs and line feeds additionally
are permitted as separators.
.TP
--filter | -f
cuts down on the amount of output from the enclosure status diagnostic
page. When this option is given, any line which has all its binary flags
cleared (i.e. 0) is filtered out (i.e. ignored). If a line has some other
value on it (e.g. a temperature) then it is output.
.TP
--help | -h
output the usage message then exit.
.TP
--hex | -H
output the response in hexadecimal.
.TP
--inner-hex | -i
the outer levels of a status diagnostic page are decoded and printed out
but the innermost level (e.g. the element status descriptor) is output in
hex.
.TP
--list | -l
list all known diagnostic page names and SES elements. <scsi_device>
is ignored and utility exits.
.TP
--page=<page_code> | -p <page_code>
Supply a <page_code>. Assumed to be in decimal unless prefixed by 0x for
hex. Valid range is 0 to 255 (0x0 to 0xff) inclusive. Default is 
page_code 0 (i.e. "Supported diagnostic pages").
.TP
--raw | -r
outputs the chosen status page in (ASCII) hex in a format suitable for
a later invocation using the '--data=" option. A status diagnostic page
less its first 4 bytes (page code and length) is output.
.TP
--status | -s
will fetch status diagnostic page from the given device via a SCSI RECEIVE
DIAGNOSTIC RESULTS command. If this option is not given and '--control' is
not given then '--status' is assumed.
.TP
--verbose | -v
increase the level of verbosity, (i.e. debug output).
.TP
--version | -V
print the version string and then exit.
.PP
Currently all status pages, control pages and element types defined in
SES-2 revision 12 (11th May 2005) are decoded. 
.PP
This utility can be used to fetch arbitrary (i.e. non SES) diagnostic
pages (using the READ DIAGNOSTIC SCSI command). To this end the '--page='
and '--hex' options would be appropriate. Arbitrary diagnostic pages can
be sent to a device with the sg_senddiag utility.
.PP
There is a related command set called SAF-TE (SCSI attached fault-tolerant
enclosure) for enclosure (including RAID) status and control. SCSI devices
that support SAF-TE report "Processor" peripheral device type (0x3) in their
INQUIRY response. See safte-monitor on the internet.
.SH EXAMPLES
To view the supported pages:
.PP
   sg_ses /dev/sda
.PP
To view the configuration page:
.PP
   sg_ses --page=1 /dev/sda
.PP
To view the status page:
.PP
   sg_ses --page=2 /dev/sda
.PP
Changing a temperature threshold is possible, if a little awkward. The
current thresholds can be shown with:
.PP
   sg_ses --page=5 /dev/sda
.PP
The threshold to be changed can be chosen. Then output the threshold page
in hex (suitable for editing) with:
.PP
   sg_ses --page=5 --raw /dev/sda > t
.PP
Then with the aid of the SES-2 document (in revision 9: section 6.1.8)
use your favourite editor to change t. The change can be sent to the
device with:
.PP
   sg_ses --control --page=5 --data=- /dev/sda < t
.PP
If the above is successful, the threshold should have been changed. To
check try:
.PP
   sg_ses --page=5 /dev/sda
.PP
again.
.SH EXIT STATUS
The exit status of sg_ses is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH AUTHORS
Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2004-2006 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B sg_inq, sg_senddiag (in sg3_utils package); safte-monitor (internet)