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       Those interested in SCSI mode pages may find the sdparm utility  easier
20       use, especially for changing parameters.
21
22       Four sets of values are maintained by a SCSI device for each mode page:
23       current (active), default (manufacturer's supplied values), saved (val‐
24       ues  that are retained if the SCSI device is powered down), and change‐
25       able (mask indicating those values that can be  changed).   By  default
26       when a mode page is displayed the current values are shown. This can be
27       overridden by "-M" (defaults), "-S" (saved) or "-m"  (modifiable  (i.e.
28       changeable)).
29
30       Many  mode  pages  are decoded: for disks (see SBC-2), for CD/DVDs (see
31       MMC-2/3/4/5), for tapes (see SSC-2) and  for  enclosures  (see  SES-2).
32       Some  mode pages common to all SCSI peripheral device types are defined
33       in SPC-4 (primary commands). A decoded mode page has its field names in
34       the  first  column and the corresponding value in the second column.  A
35       "hex" mode page (and subpage) has its byte position in the first column
36       (in  hex  and  starting  at 0x2) and the corresponding hex value in the
37       second column. Decoded pages can be viewed with the '-t' option or with
38       a  specific  option  (e.g.  'c'  for the caching mode page).  Naturally
39       decoded pages must be supplied by the DEVICE  and  recognised  by  this
40       program. If supported by the device, decoded pages may be modified. All
41       mode pages (and subpages) that the device supports can be viewed in hex
42       (and potentially modified) via the "-u" option
43
44       If no options are given that will cause mode page(s) or INQUIRY data to
45       be printed out, then a brief INQUIRY response is output. This  includes
46       the vendor, product and revision level of the device.
47

OPTIONS

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

ADVANCED OPTIONS

154       Only  one  of  the  following  three options can be specified.  None of
155       these three implies the current values are returned.
156
157       -m     Display modifiable fields instead of current values
158
159       -M     Display manufacturer's defaults instead of current values
160
161       -S     Display saved defaults instead of current values
162
163       The following are advanced  options,  not  generally  suited  for  most
164       users:
165
166       -X     Display  output values in a list. Make them suitable for editing
167              and being given back to the '-R' (replace command).
168
169       \-R    Replace parameters - best used with -X (expert use only)
170

CHANGING MODE PAGE PARAMETERS

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

GENERATING SCRIPT FILES AND HEX PAGES

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

RESTRICTIONS

241       The SCSI MODE SENSE command yields block descriptors as well as a  mode
242       page(s).  This  utility  ignores block descriptors and does not display
243       them. The "disable block descriptor" switch (DBD)  in  the  MODE  SENSE
244       command is not set since some devices yield errors when it is set. When
245       mode page values are being changed (the "-R" option),  the  same  block
246       descriptor  obtained  by  reading  the mode page (i.e. via a MODE SENSE
247       command) is sent back when the mode page is written (i.e.  via  a  MODE
248       SELECT command).
249

REFERENCES

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

AUTHORS

257       Written by  Eric  Youngdale,  Michael  Weller,  Douglas  Gilbert,  Kurt
258       Garloff, Thomas Steudten
259

HISTORY

261       scsiinfo  version  1.0  was  released by Eric Youngdale on 1st November
262       1993.  The most recent version of scsiinfo is version 1.7 with the last
263       patches by Michael Weller. sginfo is derived from scsiinfo and uses the
264       sg interface to get around the 4  KB  buffer  limit  in  scsiinfo  that
265       cramped  the  display of defect lists especially. sginfo was written by
266       Douglas Gilbert with patches from Kurt  Garloff.  This  manpage  corre‐
267       sponds  with  version  2.01  of  sginfo.  It may be backported (or just
268       copied) soon to become scsiinfo 2.01 .
269
270       This software is distributed under the GPL version 2. There is NO  war‐
271       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
272       POSE.
273

SEE ALSO

275       plscsi(internet),       scsiinfo(internet),        sg_modes(sg3_utils),
276       sg_inq(sg3_utils), sdparm(sdparm)
277
278       plscsi  can  send  arbitrary (user supplied) SCSI commands; scsiinfo is
279       the predecessor of this utility; sg_modes is a  low  level  MODE  SENSE
280       based  utility and sg_inq is specialized for the mandatory SCSI INQUIRY
281       command which contains a lot of  information  about  advanced  devices.
282       Users may find sdparm more convenient for getting and setting mode page
283       parameters.
284
285
286
287sg3_utils-1.23                   December 2006                       SGINFO(8)
Impressum