1SG_SENDDIAG(8)                     SG3_UTILS                    SG_SENDDIAG(8)
2
3
4

NAME

6       sg_senddiag - performs a SCSI SEND DIAGNOSTIC command
7

SYNOPSIS

9       sg_senddiag   [--doff]  [--extdur]  [--help]  [--hex]  [--list]  [--pf]
10       [--raw=H,H...] [--raw=-] [--selftest=ST] [--test] [--uoff]  [--verbose]
11       [--version] DEVICE
12
13       sg_senddiag  [-doff]  [-e]  [-h] [-H] [-l] [-pf] [-raw=H,H...] [-raw=-]
14       [-s=ST] [-t] [-uoff] [-v] [-V] [-?] DEVICE
15

DESCRIPTION

17       This utility sends a SCSI SEND DIAGNOSTIC command to the DEVICE. It can
18       issue  self-tests,  find  supported  diagnostic pages or send arbitrary
19       diagnostic pages.
20
21       When the --list option and a DEVICE are given then the utility sends  a
22       SCSI  RECEIVE  DIAGNOSTIC  RESULTS  command to fetch the response (i.e.
23       the page numbers of supported diagnostic pages).
24
25       When the --list option is given without a DEVICE then a list  of  diag‐
26       nostic page names and their numbers, known by this utility, are listed.
27
28       This  utility  supports two command line syntaxes, the preferred one is
29       shown first in the synopsis and explained in this section. A later sec‐
30       tion  on  the  old  command  line  syntax  outlines the second group of
31       options.
32

OPTIONS

34       Arguments to long options are mandatory for short options as well.
35
36       -d, --doff
37              set the Device Offline (DevOffL) bit (default  is  clear).  Only
38              significant when --test option is set for the default self-test.
39              When set other operations on any logical units controlled by the
40              this  device  server  (target) may be affected (delayed) while a
41              default self-test is underway.
42
43       -e, --extdur
44              outputs the expected extended self-test duration.  The  duration
45              is given in seconds (and minutes in parentheses). This figure is
46              obtained from mode page 0xa (i.e. the control mode page).
47
48       -h, --help
49              print usage message then exit.
50
51       -H, --hex
52              outputs response from RECEIVE DIAGNOSTIC RESULTS in  hex  rather
53              than decode it.
54
55       -l, --list
56              when  a  DEVICE  is also given lists the names of all diagnostic
57              pages supported by this device. The request is sent via  a  SEND
58              DIAGNOSTIC  command  (with the "pF" bit set) and the response is
59              fetched by a RECEIVE DIAGNOSTIC RESULTS command.  When  used  in
60              the  absence of a --list argument then a list of diagnostic page
61              names and their numbers, known by this utility, are listed.
62
63       -O, --old
64              switch to older style options.
65
66       -p, --pf
67              set Page Format (PF) bit. By default it is clear (i.e. 0) unless
68              the  list  --list  option is given in which case the Page Format
69              bit is set (as required by SPC-3).
70
71       -r, --raw=H,H...
72              string of comma separated  hex  numbers  each  of  which  should
73              resolve  to a byte value (i.e. 0 to ff inclusive). This sequence
74              forms a diagnostic page to be sent with the SCSI SEND DIAGNOSTIC
75              command. Mostly likely the --pf option should also be given.
76
77       -r, --raw=-
78              reads  sequence  of bytes from stdin. The sequence may be comma,
79              space, tab or linefeed (newline) separated. If a  line  contains
80              "#" then the remaining characters on that line are ignored. Oth‐
81              erwise each non separator character should  resolve  to  a  byte
82              value (i.e. 0 to ff inclusive). This sequence forms a diagnostic
83              page to be sent with the SCSI SEND  DIAGNOSTIC  command.  Mostly
84              likely the --pf option should also be given.
85
86       -s, --selftest=ST
87              where  ST is the self-test code. The default value is 0 which is
88              inactive. A value of 1 selects a background short  self-test;  2
89              selects  a background extended self-test; 5 selects a foreground
90              short self-test; 6 selects a foreground extended test.  A  value
91              of  4  will  abort a (background) self-test that is in progress.
92              This option is mutually exclusive with default  self-test  (i.e.
93              --test).
94
95       -t, --test
96              sets  the _default_ Self Test (SelfTest) bit. By default this is
97              clear (0).   The  --selftest=ST  option  should  not  be  active
98              together with this option. Both the --doff and/or --uoff options
99              can be used with this option.
100
101       -u, --uoff
102              set the Unit Offline (UnitOffL) bit  (default  is  clear).  Only
103              significant when --test option is set for the default self-test.
104              When set other operations on this logical unit may  be  affected
105              (delayed)  while  a  default self-test is underway. Some devices
106              (e.g. Fujitsu disks) do more tests when this bit is set.
107
108       -v, --verbose
109              increase level of verbosity. Can be used multiple times.
110
111       -V, --version
112              print out version string then exit.
113

NOTES

115       All devices should support the default self-test. The 'short' self-test
116       codes  should  complete  in 2 minutes or less. The 'extended' self-test
117       codes' maximum duration is vendor specific (e.g. a little over 10  min‐
118       utes  with  the  author's  disks).  The foreground self-test codes wait
119       until they are completed while the background  self-test  codes  return
120       immediately.  The  results  of both foreground and background self-test
121       codes are placed in the 'self-test results' log page (see sg_logs). The
122       SCSI command timeout for this utility is set to 60 minutes to allow for
123       slow foreground extended self-tests.
124
125       If the DEVICE is a disk then no file  systems  residing  on  that  disk
126       should  be  mounted  during  a foreground self-test. The reason is that
127       other SCSI commands may become queued behind the  foreground  self-test
128       and timeout.
129
130       When  the  --raw=H,H...  option  is given then self-tests should not be
131       selected. However the --pf (i.e. "page format") option should be given.
132       The length of the diagnostic page to be sent is derived from the number
133       of bytes given to the --raw=H,H... option.  The  diagnostic  page  code
134       (number)  should be the first byte of the sequence (i.e. as dictated by
135       SPC-3 diagnostic page format). The SAS 1.1 protocol specific diagnostic
136       page  could  be sent with this option, for example. The examples subdi‐
137       rectory in the sg3_utils packages contains  two  example  scripts  that
138       turn  on  the CJTPAT (jitter pattern) on some SAS disks (one script for
139       each phy).  One  possible  invocation  is:  'sg_senddiag  --pf  --raw=-
140       /dev/sg2 < .../sdiag_sas_p1_cjtpat.txt'
141
142       Arbitrary diagnostic pages can be read (in hex) with the sg_ses utility
143       (not only those defined in SES-2).
144
145       If the utility is used with no options  (e.g.  "sg_senddiag  /dev/sg1")
146       Then a degenerate SCSI SEND DIAGNOSTIC command is sent with zero in all
147       its fields apart from the opcode. Some devices report this as an  error
148       while  others  ignore  it. It is not entirely clear from SPC-3 if it is
149       invalid to send such a command.
150
151       In the 2.4 series of Linux kernels the DEVICE must be  a  SCSI  generic
152       (sg)  device.  In the 2.6 series block devices (e.g. SCSI disks and DVD
153       drives) can also be specified. For example  'sg_senddiag  -t  /dev/sda'
154       will work in the 2.6 series kernels.
155
156       To  access SCSI enclosures see the sg_ses utility. sg_ses uses the SCSI
157       SEND DIAGNOSTIC and RECEIVE DIAGNOSTIC RESULTS commands as outlined  in
158       the SES-2 (draft) standard.
159

EXIT STATUS

161       The  exit  status  of sg_senddiag is 0 when it is successful. Otherwise
162       see the sg3_utils(8) man page.
163

OLDER COMMAND LINE OPTIONS

165       The options in this section were  the  only  ones  available  prior  to
166       sg3_utils  version  1.23  .  In  sg3_utils version 1.23 and later these
167       older options can be selected by either setting the  SG3_UTILS_OLD_OPTS
168       environment variable or using '--old' (or '-O) as the first option.
169
170       -doff  set  the  Device  Offline (DevOffL) bit (default is clear). Only
171              significant when -t option is set  for  the  default  self-test.
172              Equivalent to --doff in the main description.
173
174       -e     outputs  the expected extended self-test duration. Equivalent to
175              --extdur in the main description.
176
177       -h     outputs response from RECEIVE DIAGNOSTIC RESULTS in  hex  rather
178              than decode it.
179
180       -H     outputs  response  from RECEIVE DIAGNOSTIC RESULTS in hex rather
181              than decode it.
182
183       -l     when a DEVICE is also given lists the names  of  all  diagnostic
184              pages  supported  by this device. The request is sent via a SEND
185              DIAGNOSTIC command (with the "pf" bit set) and the  response  is
186              fetched  by  a  RECEIVE DIAGNOSTIC RESULTS command. When used in
187              the absence of a DEVICE argument then a list of diagnostic  page
188              names and their numbers, known by this utility, are listed.
189
190       -N     switch to the newer style options.
191
192       -pf    set Page Format (PF) bit. By default it is clear (i.e. 0) unless
193              the -l option is given in which case the Page Format bit is  set
194              (as required by SPC-3).
195
196       -raw=H,H...
197              string  of  comma  separated  hex  numbers  each of which should
198              resolve to a byte value (i.e. 0 to ff inclusive). This  sequence
199              forms a diagnostic page to be sent with the SCSI SEND DIAGNOSTIC
200              command. Mostly likely the -pf option should also be given.
201
202       -raw=- reads sequence of bytes from stdin. The sequence may  be  comma,
203              space,  tab  or linefeed (newline) separated. If a line contains
204              "#" then the remaining characters on that line are ignored. Oth‐
205              erwise  each  non  separator  character should resolve to a byte
206              value (i.e. 0 to ff inclusive). This sequence forms a diagnostic
207              page  to  be  sent with the SCSI SEND DIAGNOSTIC command. Mostly
208              likely the -pf option should also be given.
209
210       -s=ST  where ST is the self-test code. The default value is 0 which  is
211              inactive.  A  value of 1 selects a background short self-test; 2
212              selects a background extended self-test; 5 selects a  foreground
213              short  self-test;  6 selects a foreground extended test. A value
214              of 4 will abort a (background) self-test that  is  in  progress.
215              This  option  is mutually exclusive with default self-test (i.e.
216              -t).
217
218       -t     sets the _default_ Self Test (SelfTest) bit. By default this  is
219              clear  (0).  The -s=ST option should not be active together with
220              this option.  Both the -doff and/or -uoff options  can  be  used
221              with this option.
222
223       -uoff  set  the Unit Offline (UnitOffL) bit (default is clear). Equiva‐
224              lent to --uoff in the main description.
225
226       -v     increase level of verbosity. Can be used multiple times.
227
228       -V     print out version string then exit.
229
230       -?     output usage message. Ignore all other parameters.
231

AUTHOR

233       Written by Doug Gilbert
234

REPORTING BUGS

236       Report bugs to <dgilbert at interlog dot com>.
237
239       Copyright © 2003-2007 Douglas Gilbert
240       This software is distributed under the GPL version 2. There is NO  war‐
241       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
242       POSE.
243

SEE ALSO

245       sg_ses(sg3_utils), smartmontools(see net), sg_logs(sg3_utils)
246
247
248
249sg3_utils-1.23                   January 2007                   SG_SENDDIAG(8)
Impressum