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

OPTIONS

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

ADVANCED OPTIONS

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

CHANGING MODE PAGE PARAMETERS

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

GENERATING SCRIPT FILES AND HEX PAGES

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

RESTRICTIONS

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

REFERENCES

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

AUTHORS

266       Written  by  Eric  Youngdale,  Michael  Weller,  Douglas  Gilbert, Kurt
267       Garloff, Thomas Steudten
268

HISTORY

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

SEE ALSO

283       scsiinfo(internet);    sg_modes,    sg_inq,     sg_vpd     (sg3_utils),
284       sdparm(sdparm)
285
286
287
288sg3_utils-1.26                    March 2008                         SGINFO(8)
Impressum