aboutsummaryrefslogtreecommitdiff
path: root/sg_senddiag.8
blob: 2ad6c7fd66383530fa0f7b9c5a723b8fbf731f87 (plain)
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
.TH SG_SENDDIAG "8" "March 2003" "sg3_utils-1.03" SG3_UTILS
.SH NAME
sg_senddiag \- performs a SCSI SEND DIAGNOSTIC command
.SH SYNOPSIS
.B sg_senddiag
[\fI-cpf\fR] [\fI-doff\fR] [\fI-h\fR] [\fI-l\fR] [\fI-s=<self_test_code>\fR]
[\fI-t\fR] [\fI-uoff\fR] [\fI-V\fR] [\fI-?\fR] \fI<sg_device>\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
This command sends a SEND DIAGNOSTIC SCSI command to the given device.
In the case of '-l' option it then sends a RECEIVE DIAGNOSTIC SCSI
command to fetch the response (i.e. the page numbers of supported
diagnostic pages). This command is mainly used to make the device do
self tests.
.TP
-cpf
clear Page Format (PF) bit. By default it is set (i.e. 1).
.TP
-doff
set the Device Offline (DevOfl) bit (default is clear). Only significant 
when '-t' option is set for the default self test. In this sense the 'Device'
is a target (with all contained logical units potentially impacted).
.TP
-e
outputs the time taken for the previous extended self test. The duration
is given in seconds (and minutes in parentheses). This figure is obtained
from mode page 0xa (control page).
.TP
-h
outputs response from RECEIVE DIAGNOSTIC is hex rather than decode it.
.TP
-l
lists the names of all diagnostic pages supported by this device.
The request is sent via a SEND DIAGNOSTIC command and the response
is fetched by a RECEIVE DIAGNOSTIC command.
.TP
-s=<self_test_code>
the default value is 0 which is inactive. A value of 1 selects a background
short self test; 2 selects a background extended self test; 5 selects a 
foreground short self test; 6 selects a foreground extended test. A value
of 4 will abort a (background) self test that is in progress. This
option is mutually exclusive with default self test (i.e. '-t').
.TP
-t
sets the _default_ Self Test (SelfTest) bit. By default this is clear (0).
The '-s=<num>' option should not be active together with this option.
Both the '-doff' and/or '-uoff' options can be used with this option.
.TP
-uoff
set the Unit Offline (DevOfl) bit (default is clear). Only significant 
when '-t' option is set for the default self test. In this sense the 'Unit'
is a logical units on a target. 
.TP
-V
print out version string
.TP
-?
output usage message. Ignore all other parameters.
.PP
All devices should support the default self test. The 'short' self test
codes should complete in 2 minutes or less. The 'extended' self test
codes' maximum duration is vendor specific (e.g. a little over 10
minutes with my disks). The foreground self test codes wait until they
are completed while the background self test codes return immediately.
The results of both foreground and background self test codes are
placed in the 'self test results' log page (see sg_logs). The SCSI command
timeout for this utility is set to 40 minutes to allow for slow foreground
extended self tests.
.PP
If the given device is a disk then no file systems residing on that disk
should be mounted during a foreground self test. The reason is that
other SCSI commands may become queued behind the foreground self test and
timeout.
.PP
In the 2.4 series of Linux kernels the given device must be
a SCSI generic (sg) device. In the 2.5 series block devices (e.g. disks
and SCSI DVDs) can also be specified. For example 'sg_senddiag -t /dev/sda'
will work in the 2.5 series kernels.
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert@interlog.com>.
.SH COPYRIGHT
Copyright \(co 2003 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 smartmontools(see net), sg_logs(sg3_utils)