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). A (single)
74              space separated string of hex bytes is also allowed but the list
75              needs  to be in quotes. This sequence forms a diagnostic page to
76              be sent with the SCSI SEND DIAGNOSTIC command. Mostly likely the
77              --pf option should also be given.
78
79       -r, --raw=-
80              reads  sequence  of bytes from stdin. The sequence may be comma,
81              space, tab or linefeed (newline) separated. If a  line  contains
82              "#" then the remaining characters on that line are ignored. Oth‐
83              erwise each non separator character should  resolve  to  a  byte
84              value (i.e. 0 to ff inclusive). This sequence forms a diagnostic
85              page to be sent with the SCSI SEND  DIAGNOSTIC  command.  Mostly
86              likely the --pf option should also be given.
87
88       -s, --selftest=ST
89              where  ST is the self-test code. The default value is 0 which is
90              inactive. Some other values:
91                1 : background short self-test
92                2 : background extended self-test
93                4 : aborts a (background) self-test that is in progress
94                5 : foreground short self-test
95                6 : foreground extended self-test
96              This option is mutually exclusive with default  self-test  (i.e.
97              can't have (ST > 0) and --test).
98
99       -t, --test
100              sets  the _default_ Self Test (SelfTest) bit. By default this is
101              clear (0).   The  --selftest=ST  option  should  not  be  active
102              together with this option. Both the --doff and/or --uoff options
103              can be used with this option.
104
105       -u, --uoff
106              set the Unit Offline (UnitOffL) bit  (default  is  clear).  Only
107              significant when --test option is set for the default self-test.
108              When set other operations on this logical unit may  be  affected
109              (delayed)  while  a  default self-test is underway. Some devices
110              (e.g. Fujitsu disks) do more tests when this bit is set.
111
112       -v, --verbose
113              increase level of verbosity. Can be used multiple times.
114
115       -V, --version
116              print out version string then exit.
117

NOTES

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

EXIT STATUS

165       The  exit  status  of sg_senddiag is 0 when it is successful. Otherwise
166       see the sg3_utils(8) man page.
167

OLDER COMMAND LINE OPTIONS

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

AUTHOR

237       Written by Doug Gilbert
238

REPORTING BUGS

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

SEE ALSO

249       sg_ses(8), sg_logs(8), smartmontools(see net)
250
251
252
253sg3_utils-1.27                    April 2009                    SG_SENDDIAG(8)
Impressum