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

NAME

6       sginfo - access mode page information for a SCSI (or ATAPI) device
7

SYNOPSIS

9       sginfo [OPTIONS] [DEVICE] [REPLACEMENT_PARAMETERS]
10

DESCRIPTION

12       sginfo  is  a  port of the Linux scsiinfo program by Eric Youngdale. It
13       uses SCSI generic (sg) devices; however in some cases  the  high  level
14       device  name  (i.e. sd, sr, st, osst, or hd) can also be used. The pri‐
15       mary role of this program is to access mode page information.  If  per‐
16       mitted,  mode  page information can be altered. In addition information
17       from the INQUIRY and READ DEFECTS commands are also available.
18
19       This utility is in legacy  mode,  only  obvious  bugs  will  be  fixed.
20       Options  like  -l  (to  list  devices) are broken in recent versions of
21       Linux (e.g. 2.6 series and later); the lsscsi(8) utility  can  be  used
22       instead.  Also  mode  pages are not being updated as http://www.t10.org
23       adds and modifies mode page fields. Those interested in SCSI mode pages
24       may  find the sdparm utility more up to date and easier use, especially
25       for changing parameters.
26
27       Four sets of values are maintained by a SCSI device for each mode page:
28       current (active), default (manufacturer's supplied values), saved (val‐
29       ues that are retained if the SCSI device is powered down), and  change‐
30       able  (mask  indicating  those values that can be changed).  By default
31       when a mode page is displayed the current values are shown. This can be
32       overridden  by  "-M" (defaults), "-S" (saved) or "-m" (modifiable (i.e.
33       changeable)).
34
35       Many mode pages are decoded: for disks (see SBC-2),  for  CD/DVDs  (see
36       MMC-2/3/4/5),  for  tapes  (see  SSC-2) and for enclosures (see SES-2).
37       Some mode pages common to all SCSI peripheral device types are  defined
38       in SPC-4 (primary commands). A decoded mode page has its field names in
39       the first column and the corresponding value in the second  column.   A
40       "hex" mode page (and subpage) has its byte position in the first column
41       (in hex and starting at 0x2) and the corresponding  hex  value  in  the
42       second column. Decoded pages can be viewed with the '-t' option or with
43       a specific option (e.g. 'c' for  the  caching  mode  page).   Naturally
44       decoded  pages  must  be  supplied by the DEVICE and recognised by this
45       program. If supported by the device, decoded pages may be modified. All
46       mode pages (and subpages) that the device supports can be viewed in hex
47       (and potentially modified) via the "-u" option
48
49       If no options are given that will cause mode page(s) or INQUIRY data to
50       be  printed out, then a brief INQUIRY response is output. This includes
51       the vendor, product and revision level of the device.
52

OPTIONS

54       -6     Perform 6 byte MODE SENSE and MODE SELECT commands;  by  default
55              the 10 byte variants are used.
56
57       -a     Display some INQUIRY data and the unit serial number followed by
58              all mode pages reported by the device. It is similar to the  '-t
59              0x3f'  option.  If  the  mode page is known then it is output in
60              decoded form otherwise it is output in hexadecimal.
61
62       -A     Display some INQUIRY data and the unit serial number followed by
63              all mode pages and all mode subpages reported by the device.  It
64              is similar to the '-t 0x3f,0xff' option. If a mode (sub)page  is
65              known  then  it is output in decoded form otherwise it is output
66              in hexadecimal.
67
68       -c     Access information in the Caching mode page.
69
70       -C     Access information in the Control mode Page.
71
72       -d     Display defect lists (default format: index).
73
74       -D     Access information in the Disconnect-Reconnect mode page.
75
76       -e     Access information in the Error Recovery mode page.
77
78       -E     Access information in the Control Extension mode page.
79
80       -f     Access information in the Format Device mode page.
81
82       -Farg  Format of the defect lists:
83                              -Flogical  - logical block addresses (32 bit)
84                              -Flba64    - logical block addresses (64 bit)
85                              -Fphysical - physical blocks
86                              -Findex    - defect bytes from index
87                              -Fhead     - sort by head
88              Used in conjunction with "-d" or "-G". If a format is not  given
89              "index" is assumed.
90
91       -g     Access information in the Rigid Disk Drive Geometry mode page.
92
93       -G     Display grown defect list (default format: index).
94
95       -i     Display the response to a standard INQUIRY command.
96
97       -I     Access the Informational Exceptions mode page.
98
99       -l     Deprecated. Only use in old versions of Linux (e.g. 2.4 and ear‐
100              lier). Please use lsscsi(8) in the Linux 2.6 series  and  later.
101              List known SCSI devices on the system.
102
103       -n     Access information in the Notch and Partition mode page.
104
105       -N     Negate (i.e. stop) mode page changes being placed in the "saved"
106              page (by default changes go to the current and the saved  page).
107              Only active when used together with '-R'.
108
109       -P     Access information in the Power Condition mode page.
110
111       -r     Display  all  raw  (or primary) SCSI device names visible in the
112              /dev directory. Examples are /dev/sda, /dev/st1  and  /dev/scd2.
113              Does  not  list sg device names so devices such as a SCSI enclo‐
114              sure which only have an sg device name are not listed.
115
116       -s     Display information in the unit serial number page  which  is  a
117              INQUIRY command variant.
118
119       -t PN[,SPN]
120              Display information from mode page number PN (and optionally sub
121              page number SPN) in decoded format (if known, otherwise  in  hex
122              form).   PN  is a mode page number in a decimal number from 0 to
123              63 inclusive.  SPN is the mode subpage number and is assumed  to
124              be 0 if not given.  SPN is a decimal number from 1 to 255 inclu‐
125              sive. A page number of 63 returns all  pages  supported  by  the
126              device  in  ascending order except for page 0 which, if present,
127              is last. Page 0 is vendor specific and not necessarily  in  mode
128              page  format.  Alternatively hex values can be given for both PN
129              and SPN (both prefixed by '0x').
130
131       -T     Trace commands to obtain more verbose  output  (for  debugging).
132              When  used  once SCSI commands are shown (in hex) and any errors
133              from these SCSI commands are spelt out (i.e.  with a decoded and
134              raw  sense  buffer).  When  used twice, the additional data sent
135              with mode select and the response from mode sense are shown  (in
136              hex).
137
138       -u PN[,SPN]
139              Display  information  from  mode  page number PN (and optionally
140              SPN) in hex form. PN is a mode page number in a  decimal  number
141              from  0  to  63 inclusive. SPN is the mode subpage number and is
142              assumed to be 0 if not given. SPN is a decimal number from 1  to
143              255  inclusive.  A page number of 63 returns all pages supported
144              by the device in ascending order except for  page  0  which,  if
145              present,  is last. Page 0 is vendor specific and not necessarily
146              in mode page format. Alternatively hex values can be  given  for
147              both PN and SPN (both prefixed by '0x'). For example 63 and 0x3f
148              are equivalent.
149
150       -v     Display version string then exit. [N.B.  This  option  increases
151              verbosity  for  most other utilities in this package as outlined
152              in 'man 8 sg3_utils'.  This odd usage is for  backward  compati‐
153              bility with the scsiinfo utility.]
154
155       -V     Access information in the Verify Error Recovery mode page. [N.B.
156              This option prints the version string then exits in  most  other
157              utilities in this package as outlined in 'man 8 sg3_utils'. This
158              odd usage is for backward compatibility with the scsiinfo  util‐
159              ity.]
160
161       -z     do  a  single fetch for mode pages (over-estimating the expected
162              length of the returned response). The default action is to do  a
163              double  fetch,  the  first  fetch is to find the response length
164              that could be returned. Devices  that  closely  adhere  to  SCSI
165              standards  should  not  require  this  option,  some  real world
166              devices do require it.
167

ADVANCED OPTIONS

169       Only one of the following three options  can  be  specified.   None  of
170       these three implies the current values are returned.
171
172       -m     Display modifiable fields instead of current values
173
174       -M     Display manufacturer's defaults instead of current values
175
176       -S     Display saved defaults instead of current values
177
178       The  following  are  advanced  options,  not  generally suited for most
179       users:
180
181       -X     Display output values in a list. Make them suitable for  editing
182              and being given back to the '-R' (replace command).
183
184       -R     Replace parameters - best used with -X (expert use only)
185

CHANGING MODE PAGE PARAMETERS

187       Firstly  you  should  know  what you are doing before changing existing
188       parameters. Taking the control page as an example, first  list  it  out
189       normally  (e.g.  "sginfo -C /dev/sda") and decide which parameter is to
190       be changed (note its position relative to the other lines output). Then
191       execute  the  same sginfo command with the "-X" option added; this will
192       output the parameter values in a single row in the same relative  posi‐
193       tions  as  the previous command. Now execute "sginfo -CXR /dev/sda ..."
194       with the "..." replaced by the single row of values output by the  pre‐
195       vious  command,  with the relevant parameter changed. Here is a simpli‐
196       fied example:
197
198          $ sginfo -C /dev/sda
199          Control mode page (0xa)
200          -----------------------
201          TST                        0
202          D_SENSE                    0
203          GLTSD                      1
204          RLEC                       0
205
206       [Actually the Control page has more parameters that shown above.]  Next
207       output those parameters in single line form:
208
209          $ sginfo -CX /dev/sda
210          0 0 1 0
211
212       Let  us  assume  that  the GLTSD bit is to be cleared. The command that
213       will clear it is:
214
215          $ sginfo -CXR /dev/sda 0 0 0 0
216
217       The same number of parameters output by the "-CX" command needs  to  be
218       placed  at  the end of the "-CXR" command line (after the device name).
219       Now check that the change took effect:
220
221          $ sginfo -C /dev/sda
222          Control mode page (0xa)
223          -----------------------
224          TST                        0
225          D_SENSE                    0
226          GLTSD                      0
227          RLEC                       0
228
229       When a mode page is "replaced" the default action is to change both the
230       current  page  and  the saved page. [For some reason versions of sginfo
231       and scsiinfo prior to 2.0 did not change the "saved" page.]  To  change
232       only the current mode page but not the corresponding saved page use the
233       "-N" option.
234

GENERATING SCRIPT FILES AND HEX PAGES

236       The "-aX" or "-AX" option generates output suitable for a script  file.
237       Mode pages are output in list format (after the INQUIRY and serial num‐
238       ber) one page per line. To facilitate running the output as (part of) a
239       script file to assert chosen mode page values, each line is prefixed by
240       "sginfo -t PN[,SPN] -XR ". When such a script file is run, it will have
241       the  effect of re-asserting the mode page values to what they were when
242       the "-aX" generated the output.
243
244       All mode pages (and subpages) supported by the device can  be  accessed
245       via  the  -t  and  -u  options.  To see all mode pages supported by the
246       device use "-u 63". [To see all mode pages and  all  subpages  use  "-u
247       63,255".]  To list the control mode page in hex (mode page index in the
248       first column and the corresponding byte value in the second column) use
249       "-u  0xa".  Mode  pages  (subpage  code == 0) start at index position 2
250       while subpages start at index position 4.  If the "-Xu ..."  option  is
251       used  then  a  list  a hex values each value prefixed by "@" is output.
252       Mode (sub)page values can then be modified with the "-RXu ..." option.
253

RESTRICTIONS

255       The SCSI MODE SENSE command yields block descriptors as well as a  mode
256       page(s).  This  utility  ignores block descriptors and does not display
257       them. The "disable block descriptor" switch (DBD)  in  the  MODE  SENSE
258       command is not set since some devices yield errors when it is set. When
259       mode page values are being changed (the "-R" option),  the  same  block
260       descriptor  obtained  by  reading  the mode page (i.e. via a MODE SENSE
261       command) is sent back when the mode page is written (i.e.  via  a  MODE
262       SELECT command).
263

REFERENCES

265       SCSI  (draft)  standards can be found at http://www.t10.org . The rele‐
266       vant documents are SPC-4 (mode pages common to all device types), SBC-2
267       (direct  access  devices  [e.g. disks]), MMC-4 (CDs and DVDs) and SSC-2
268       (tapes).
269

AUTHORS

271       Written by  Eric  Youngdale,  Michael  Weller,  Douglas  Gilbert,  Kurt
272       Garloff, Thomas Steudten
273

HISTORY

275       scsiinfo  version  1.0  was  released by Eric Youngdale on 1st November
276       1993.  The most recent version of scsiinfo is version 1.7 with the last
277       patches by Michael Weller. sginfo is derived from scsiinfo and uses the
278       sg interface to get around the 4  KB  buffer  limit  in  scsiinfo  that
279       cramped  the  display of defect lists especially. sginfo was written by
280       Douglas Gilbert with patches from Kurt  Garloff.  This  manpage  corre‐
281       sponds with version 2.25 of sginfo.
282
283       This  software is distributed under the GPL version 2. There is NO war‐
284       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
285       POSE.
286

SEE ALSO

288       lsscsi(lsscsi),    scsiinfo(internet);    sg_modes,    sg_inq,   sg_vpd
289       (sg3_utils), sdparm(sdparm)
290
291
292
293sg3_utils-1.38                   January 2014                        SGINFO(8)
Impressum