1SDPARM(8)                           SDPARM                           SDPARM(8)
2
3
4

NAME

6       sdparm - access SCSI modes pages; read VPD pages; send simple SCSI com‐
7       mands.
8

SYNOPSIS

10       sdparm  [--all]  [--dbd]  [--flexible]  [--get=STR]  [--hex]   [--long]
11       [--num-desc] [--page=PG[,SPG]] [--quiet] [--readonly] [--six] [--trans‐
12       port=TN] [--vendor=VN] [--verbose] DEVICE [DEVICE...]
13
14       sdparm    [--clear=STR]     [--defaults]     [--dummy]     [--flexible]
15       [--page=PG[,SPG]]  [--quiet]  [--readonly] [--save] [--set=STR] [--six]
16       [--transport=TN] [--vendor=VN] [--verbose] DEVICE [DEVICE...]
17
18       sdparm   --command=CMD   [--hex]   [--readonly]   [--verbose]    DEVICE
19       [DEVICE...]
20
21       sdparm    --inquiry    [--all]    [--flexible]   [--hex]   [--num-desc]
22       [--page=PG[,SPG]] [--quiet] [--readonly] [--transport=TN] [--vendor=VN]
23       [--verbose] DEVICE [DEVICE...]
24
25       sdparm   --enumerate  [--all]  [--inquiry]  [--long]  [--page=PG[,SPG]]
26       [--transport=TN] [--vendor=VN]
27
28       sdparm --inhex=FN [--all]  [--flexible]  [--hex]  [--inquiry]  [--long]
29       [--pdt=DT] [--raw] [--six] [--transport=TN] [--vendor=VN]
30
31       sdparm --wscan [--verbose]
32
33       sdparm [--help] [--version]
34

DESCRIPTION

36       This  utility  fetches and potentially changes SCSI device (e.g.  disk)
37       mode pages. Inquiry data including Vital Product Data (VPD)  pages  can
38       also  be  displayed. Commands associated with starting and stopping the
39       medium; loading and unloading the medium; and other housekeeping  func‐
40       tion may also be issued by this utility.
41
42       The  first  invocation shown in the synopsis is for accessing (reading)
43       mode page fields held on the DEVICE. The second form  is  for  changing
44       mode  page  fields  held on the DEVICE. The third form is for executing
45       some simple SCSI commands. The fourth form (i.e.   the  '--inquiry  ...
46       DEVICE'  form)  is  for  fetching and decoding VPD pages from the given
47       DEVICE. The --enumerate form is for listing out mode or VPD field  data
48       held by this utility (and if a DEVICE is given then it is ignored). The
49       --inhex=FN form decodes mode or VPD response data provided in the named
50       file (or from stdin if FN is '-'); that data may either be in hexadeci‐
51       mal or binary. The second last form is for Windows only and  lists  the
52       available  storage device names; see the OPTIONS entry for --wscan. The
53       final form is to provide command line help or the version  number  (and
54       date).
55
56       If  no options (other than DEVICE) are given then a selection of common
57       mode page fields for that device are listed. If the  --long  option  is
58       also  given  then a description of the fields is placed on the right of
59       each line. If the --all option is given then all known mode page fields
60       for that device are listed. Individual fields can be displayed with the
61       --get=STR option (e.g. '--get=WCE' to fetch the state of the  Writeback
62       Cache Enable field).
63
64       This  utility  completes  with an exit status of 0 when successful. For
65       other values see the EXIT STATUS section below.
66
67       One or more DEVICE arguments can be given. The utility will essentially
68       apply  the  given  options  to each DEVICE in the list.  If an error is
69       detected, it is noted and the utility continues.  Error value  5  (file
70       open  or  close problem) is treated as lower priority when other errors
71       are detected. The exit status is the most recently detected error value
72       (excluding  error  value  5 if other errors have been detected). If all
73       actions succeed the exit status is zero.
74
75       By default this utility shows mode pages that are common to all  trans‐
76       port  protocols. These are termed as "generic" mode pages.  If there is
77       no match on a generic mode page name or field then those pages specific
78       to  the  SAS  transport  are checked.  Transport protocol specific mode
79       pages are selected with the --transport=TN option.  See  the  TRANSPORT
80       section below.  Vendor specific mode pages are selected with the --ven‐
81       dor=VN option.  See the VENDORS section below.
82
83       Although originally for SCSI disks (or storage devices that  appear  to
84       the  OS as SCSI disks) many of the mode pages are for other SCSI device
85       types.  These include CD/DVD players that use the ATAPI (or any  other)
86       transport, SCSI tapes drives and SCSI enclosures.
87
88       When  the  --inquiry  option  is  given  without a page number then the
89       Device Identification VPD page (page number 0x83) is requested  and  if
90       found  it  is  decoded  and  output. If no page number is given and the
91       --all option is given then a list of VPD page names (but not their con‐
92       tents)  supported  by the DEVICE is output. When both the --inquiry and
93       --page=PG options are given then the VPD page can be  specified  as  an
94       abbreviation  (e.g.  "sp"  for  the SCSI ports VPD page) or numerically
95       (e.g. "0x88"). If a VPD page is returned by the DEVICE but sdparm  can‐
96       not decode it or the --hex option is given then it is output in hex.
97

OPTIONS

99       Mandatory  arguments to long options are mandatory for short options as
100       well.  If an option takes a numeric  argument  then  that  argument  is
101       assumed  to  be decimal unless otherwise indicated (e.g. with a leading
102       "0x" or a trailing "h"). The options are in alphabetical  order,  based
103       on the long option name.
104
105       -a, --all
106              output  all recognized fields for the device type (e.g. disk) of
107              the DEVICE. Without this option (or the --page=PG[,SPG]  option)
108              the  default  action  is  to output a relatively small number of
109              commonly used fields  from  different  pages.  When  a  specific
110              (mode) page number is given with the --page=PG[,SPG] option then
111              all the fields of that page are output (irrespective of the set‐
112              ting  of  this  option). For this option's action when used with
113              the --enumerate option see the ENUMERATE section below.
114              By default --inhex=FN will only decode the first mode page found
115              in  FN.  With  this  option,  more mode pages will be decoded if
116              present. When --transport=TN or --vendor=VN is also  given  then
117              if  a  given mode page is not defined for that transport or ven‐
118              dor, then it is decoded as a generic mode page.
119
120       -c, --clear=STR
121              In its simplest form STR contains  a  field  acronym_name  or  a
122              field  numerical descriptor. In the absence of an explicit value
123              argument (e.g. '--clear=WCE=1'), the field has its value cleared
124              to zero.  See the PARAMETERS section below.
125
126       -C, --command=CMD
127              Perform  given  CMD. See section below on COMMANDS. To enumerate
128              supported commands use '-e -C x' (using any CMD name,  valid  or
129              otherwise).
130
131       -B, --dbd
132              disable block descriptors. This is a bit in MODE SENSE cdbs that
133              rarely needs to be set. One known case is a MODE SENSE 6  issued
134              to  a Reduced Block Commands (RBC) device where the RBC standard
135              says it shall be set.
136
137       -D, --defaults
138              sets the given mode page to its  default  values.  Requires  the
139              --page=PG[,SPG]  option to be given to specify the mode page. To
140              make the default mode page values also the saved mode page  val‐
141              ues, use the --save option as well.
142
143       -d, --dummy
144              when  set  inhibits  changes  being  placed in the DEVICE's mode
145              page.  Instead the mode data that would have been sent to a MODE
146              SELECT  command,  is  output  in  ASCII hex to the console. This
147              option is mainly for testing.
148
149       -e, --enumerate
150              lists out descriptive information about  the  pages  and  fields
151              known  to  this  utility.  Ignores the DEVICE argument and other
152              options   apart   from    the    --all,    --inquiry,    --long,
153              --page=PG[,SPG],  --transport=TN and --vendor=VN. If --enumerate
154              is given without other options then  the  known  (generic)  mode
155              pages are listed.  See the ENUMERATE section below.
156
157       -f, --flexible
158              Some  devices,  bridges and/or drivers attempt crude transforma‐
159              tions between mode sense 6 and 10  byte  commands  without  cor‐
160              rectly rebuilding the response.  This will cause the response to
161              be mis-interpreted (usually with an error saying the response is
162              malformed).  With  this  option,  the  length of the response is
163              checked,  and  if  it  looks  wrong,  various  corrections   are
164              attempted.  This  option  will  also allow mode pages that don't
165              belong to the current device's peripheral type to be listed.
166
167       -g, --get=STR
168              In its simplest form STR contains  a  field  acronym_name  or  a
169              field numerical descriptor. The field is fetched from mode page.
170              See the PARAMETERS section below. The --long and  --hex  options
171              effect  the output format. Also if a value of "1" is given (e.g.
172              '--get=WCE=1') only the current value is output  (i.e.  not  the
173              change mask, the default value and the saved value).
174
175       -h, --help
176              output the usage message then exit.
177
178       -H, --hex
179              rather than trying to decode mode (or VPD) pages, print them out
180              in hex. When used with the --get=STR  option  the  corresponding
181              current, changeable, default and saved values are output in hex,
182              prefixed by "0x" and space separated. If a value of "1" is given
183              with  the  --get=STR  option  (e.g. '--get=WCE=1') then only the
184              current value is output in hex, prefixed by "0x". If a value  of
185              "2"  is  given  with  the --get=STR option then only the current
186              value is output as a (signed) integer. This option can  be  used
187              multiple times (e.g. '-HH'). Useful with the ATA Information VPD
188              page which usually outputs its IDENTIFY (PACKET) DEVICE response
189              in  16  bit  hex  words; with '-HH' outputs that response in hex
190              bytes; with '-HHH' outputs the same response in a  format  suit‐
191              able for 'hdparm --Istdin' to decode.
192
193       -i, --inquiry
194              output  a  VPD  page  which is in the response of a SCSI INQUIRY
195              command sent to DEVICE.  In  the  absence  of  this  option  the
196              default  action is to output mode pages. If the --inquiry option
197              is given without the  --page=PG[,SPG]  option  then  the  device
198              identification  VPD  page  (0x83) is decoded and output. If this
199              option and the --all option are given  then  the  supported  VPD
200              pages page (0x0) is decoded and output.
201
202       -I, --inhex=FN
203              FN  is  expected to be a file name (or '-' for stdin) which con‐
204              tains ASCII hexadecimal (or binary) representing the response to
205              MODE  SENSE(10).   If --six is also given then the response from
206              MODE SENSE(6) is assumed. A MODE SENSE response contains one  or
207              more  mode  pages. This utility will decode the first one unless
208              the --all option is given. In order to decode a  mode  page  the
209              peripheral  device type is often needed and can be supplied with
210              the --pdt=DT option. If the --pdt=DT is not given  then  a  mode
211              page  found  in two device type standards (e.g. SBC and SSC) may
212              be decoded twice.
213              If --inquiry is given then FN is  interpreted  as  the  response
214              data of a single VPD page.
215              The hexadecimal in FN should be arranged as 1 or 2 digits repre‐
216              senting a byte each of which is whitespace or  comma  separated.
217              Anything  from  and  including a hash mark to the end of line is
218              ignored. If the --raw option is given  then  FN  is  treated  as
219              binary.
220
221       -l, --long
222              output  extra  information.  In  the  case of mode page fields a
223              description (with units if applicable) is output to  the  right.
224              If  used  twice, then for some fields more information about its
225              values is given on one or more following lines, each prefixed by
226              a  tab  character.  For usage with --enumerate see the ENUMERATE
227              section below.
228
229       -n, --num-desc
230              for a mode  page  that  can  have  descriptors,  the  number  of
231              descriptors  for  the given page on the DEVICE is output. Other‐
232              wise 0 is output.
233
234       -p, --page=PG[,SPG]
235              supply the page number (PG) and optionally the sub  page  number
236              (SPG)  of  the  mode  (or  VPD) page to fetch. These numbers are
237              interpreted as decimal unless prefixed with "0x" or a  trailing.
238              Sub  page numbers are only valid for mode pages (not VPD pages).
239              Alternatively an abbreviation for a page can be given (see  next
240              entry).
241
242       -p, --page=STR
243              a  two  or  three  letter  abbreviation for a page can be given.
244              Known mode page abbreviations  are  checked  first  followed  by
245              known  VPD  page abbreviations.  For example '--page=ca' matches
246              the caching mode page. If no match is found  then  an  error  is
247              issued  and  a  list  of possibilities in the current context is
248              given (so '-p x' can be quite useful).  If  the  STR  matches  a
249              known  VPD  page  abbreviation  then  the  --inquiry  option  is
250              assumed. For usage with --enumerate see  the  ENUMERATE  section
251              below.
252
253       -P, --pdt=DT
254              This  option is only active when the --inhex=FN option is given.
255              DT is the peripheral Device Type, a value between 0 and  31  and
256              can  be found in the reponse to the INQUIRY command. The default
257              value is -1 (which may also be given for DT) and  it  is  inter‐
258              preted  as  SPC  (i.e.  common mode pages) or as a wild card. If
259              available this option should be  supplied  with  the  --inhex=FN
260              option.
261
262       -q, --quiet
263              suppress  output  of device name followed by the vendor, product
264              and revision strings fetched from an INQUIRY  response.  Without
265              this  option  such  a line is typically the first line output by
266              sdparm. Reduces output from the device identification VPD  page,
267              typically  to  one  line  (or  none) for each of di_lu, di_port,
268              di_target and di_asis.
269              If this option is used twice then additionally mode page  output
270              suppresses  the  changeable,  default  and saved values that are
271              usually shown in braces, if available.
272
273       -r, --readonly
274              override other logic to  open  DEVICE  in  read-only  mode.  The
275              default setting of the open read-only/read-write mode depends on
276              the operation requested (e.g. a --set=STR operation  by  default
277              will  try  a read-write mode open on DEVICE). This option may be
278              useful if a command is being sent to an ATA disk via a SCSI com‐
279              mand set. For example in Linux '-C stop' may require this option
280              to stop an ATA disk being restarted immediately.
281
282       -R, --raw
283              this option is only active when used with the --inhex=FN option.
284              When  this  option  is  given then the file FN is interpreted as
285              binary; the default action (i.e. when this option is not  given)
286              is to interpret FN as ASCII hexadecimal.
287
288       -S, --save
289              when  a  mode  page  is being modified (by using the --clear=STR
290              and/or --set=STR options) then the default action is  to  modify
291              only  the  current  values  mode page. When this option is given
292              then the corresponding value(s) in the saved values mode page is
293              also  changed.  The  next  time  the  device is power cycled (or
294              reset) the saved values mode page becomes (i.e.  is  copied  to)
295              the  current  values mode page. This option sets the SP field in
296              the MODE SELECT command. See NOTES section below.
297
298       -s, --set=STR
299              in its simplest form STR contains  a  field  acronym_name  or  a
300              field numerical descriptor. In the absence of an explicit value,
301              each acronym_name has its value set to (all) ones. This means  a
302              16  bit  field  will be set to 0xffff which is 65535 in decimal.
303              Alternatively each acronym_name or numerical descriptor  may  be
304              followed  by "=<n>" where <n> is the value to set that field to.
305              See the PARAMETERS section below.
306
307       -6, --six
308              The default action of this utility is to issue  MODE  SENSE  and
309              MODE SELECT SCSI commands with 10 byte cdbs. When this option is
310              given the 6 byte cdb variants are used. RBC and old SCSI devices
311              may  need  this option. This utility outputs a suggestion to use
312              this option if the SCSI status indicates that the  10  byte  cdb
313              variant is not supported.
314
315       -t, --transport=TN
316              Specifies  the transport protocol where TN is either a number in
317              the range 0 to 15 (inclusive) or an abbreviation (e.g. "fcp" for
318              the Fibre Channel Protocol). One way to list available transport
319              protocols numbers and their associated abbreviations is to  give
320              an invalid transport protocol number such as '-t x'; another way
321              is '-e -l'.  N.B. The --all option may still be needed  to  show
322              all available fields.
323
324       -M, --vendor=VN
325              Specifies  the  vendor  (i.e. manufacturer) where VN is either a
326              number (0 or more) or an abbreviation (e.g.  "sea"  for  Seagate
327              disk vendor specific).  One way to list available vendor numbers
328              and their associated abbreviations is to give an invalid  vendor
329              number such as '-M x'; another way is '-e -l'.
330
331       -v, --verbose
332              increase  the  level  of verbosity, (i.e. debug output). In some
333              cases more decoding is  done  (e.g.  fields  within  a  standard
334              INQUIRY response).
335
336       -V, --version
337              print the version string and then exit.
338
339       -w, --wscan
340              this  option  is  available  in  Windows  only. It lists storage
341              device names and the corresponding volumes, if  any.  When  used
342              twice  it  adds  the "bus type" of the closest transport (e.g. a
343              SATA disk in a USB connected enclosure has bus type  Usb).  When
344              used  three  times  a SCSI adapter scan is added. When used four
345              times only a SCSI adapter scan is shown.  See examples below and
346              the "Win32 port" section in the README file.
347

NOTES

349       The  reference  document  used for interpreting mode and VPD pages (and
350       the INQUIRY standard  response)  is  T10/BSR  INCITS  502  Revision  02
351       (SPC-5,  3  January  2015)  found  at http://www.t10.org . Obsolete and
352       reserved items in the standard INQUIRY response output are displayed in
353       brackets.  Recent  drafts  of  other T10 documents are also used: SBC-4
354       (disks), SSC-5 (tapes), SPL-4 (SAS transport) and SAT-4  (SCSI  to  ATA
355       Translation).
356
357       A  mode page for which no abbreviation is known (e.g. a vendor specific
358       mode page) can be listed in hexadecimal by using the option combination
359       '--page=PG --hex'.
360
361       Numbers  input  to  sdparm  (e.g.  in  the  command line arguments) are
362       assumed to be in decimal unless there is  a  hexadecimal  indicator.  A
363       hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C lan‐
364       guage convention) or a trailing 'h' or 'H' (i.e. the convention used at
365       www.t10.org  ).  In  the  case  of --page= either a string or number is
366       expected, so hex numbers like 'ch' (12) should be prefixed  by  a  zero
367       (e.g. '0ch').
368
369       The SPC-4 draft (rev 2) says that devices that implement no distinction
370       between current and saved pages can return an error  (ILLEGAL  REQUEST,
371       invalid  field  in  cdb) if the SP bit (which corresponds to the --save
372       option) is _not_ set. In such cases  the  --save  option  needs  to  be
373       given.
374
375       If the --save option is given but the existing mode page indicates (via
376       its PS bit) that the page is not savable, then this  utility  generates
377       an error message. That message suggests to try again without the --save
378       option.
379
380       Since the device identification VPD  page  (acronym_name  "di")  poten‐
381       tially  contains  a  lot  of  diverse  designators,  several associated
382       acronyms are available. They are  "di_lu"  for  designators  associated
383       with  the  addressed logical unit, "di_port" for designators associated
384       with the target port (which the command arrived  via)  and  "di_target"
385       for  designators  associated  with the target device. When "di" is used
386       designators are grouped by lu, then port and then  target  device.   To
387       see  all  designators  decoded in the order that they appear in the VPD
388       page use "di_asis".
389
390       Only those VPD pages defined by t10.org are decoded  by  this  utility.
391       SPC-4 sets aside VPD pages codes from 0xc0 to 0xff (inclusive) for ven‐
392       dor specific pages some of which are decoded in the sg_vpd utility.
393
394       To see all VPD pages supported by a DEVICE use 'sg_vpd --all'.
395
396       In the linux kernel 2.6 and 3 series any device node that understands a
397       SCSI  command set (e.g. SCSI disks and CD/DVD drives) may be specified.
398       More precisely the driver that "owns" the device node must support  the
399       SG_IO  ioctl.  In the lk 2.4 series only SCSI generic (sg) device nodes
400       support the SG_IO ioctl. However in the lk 2.4 series other SCSI device
401       nodes  are  mapped within this utility to their corresponding sg device
402       nodes. So if there is a SCSI disk at /dev/sda  then  'sdparm  /dev/sda'
403       will  work  in both the lk 2.4 series and later. However if there is an
404       ATAPI cd/dvd drive at /dev/hdc then 'sdparm /dev/hdc' will only work in
405       the lk 2.6 series and later.
406
407       In  the Linux 2.6 and 3 series, especially with ATA disks, using sdparm
408       to stop (spin down) a disk may not be sufficient and  other  mechanisms
409       will  start the disk again some time later. The user might additionally
410       mark    the    disk    as    "offline"    with    'echo    offline    >
411       /sys/block/sda/device/state'  where  sda is the block name of the disk.
412       To restart the disk "offline" can be replaced with "running".
413

PARAMETERS

415       In their simplest form the --clear=,  --get=  and  --set=  options  (or
416       their  short  forms) take an acronym_name such as "WCE". In the case of
417       '--get=WCE' the value of "Writeback Cache Enable" in the  caching  mode
418       page  will  be fetched. In the case of '--set=WCE' that bit will be set
419       (to one). In the case of '--clear=WCE' that bit  will  be  cleared  (to
420       zero). When an acronym_name is given then the mode page is imputed from
421       that acronym_name (e.g. WCE is in the caching mode page).
422
423       Instead of an acronym_name a field within a mode page can be  described
424       numerically with a <start_byte>:<start_bit>:<num_bits> tuple. These are
425       the <start_byte> (origin 0) within the mode page, a <start_bit> (0 to 7
426       inclusive)  and  <num_bits>  (1  to 64 inclusive). For example, the low
427       level representation of the RCD bit (the "Read Cache Disable bit in the
428       caching mode page) is "2:0:1". The <start_byte> can optionally be given
429       in hex (e.g. '--set=0x2:0:1' or '--set=2h:0:1').  With  this  form  the
430       --page= option is required to establish which mode page is to be used.
431
432       Either form can optionally be followed by "=<val>". By default <val> is
433       decimal but can be given in hex in the normal fashion.  Here  are  some
434       examples: '--set=2h:0:1=1h' and '-s MRIE=0x3'. When the acronym_name or
435       numeric form following --clear= is not given an explicit '=<val>'  then
436       the  value defaults to zero. When the acronym_name or numeric form fol‐
437       lowing --set= is not given an explicit '=<val>' then the value defaults
438       to  "all  ones"  (i.e.  as  many  as  <num_bits>  permits). For example
439       '--clear=WCE' and '--clear=WCE=0' have the same meaning:  clear  Write‐
440       back Cache Enable or, put more simply: turn off the writeback cache.
441
442       Multiple  fields  within  the same mode page can be changed by giving a
443       comma separated list of acronym_names and/or the  numerical  form.  For
444       example: '--set=TEST,MRIE=6'.
445
446       Some  mode  page have multiple descriptors. They typically have a fixed
447       header section at the start of the mode page that includes a field con‐
448       taining  the number of descriptors that follow. Following the header is
449       a variable number of descriptors. An example is the SAS Phy Control and
450       Discover  mode  page.  An  acronym_name may include a trailing '.<num>'
451       where "<num>" is a descriptor number (origin 0). For example '-t sas -g
452       PHID.0' and '-t sas -g PHID' will yield the phy identifier of the first
453       descriptor of the above mode page; '-t sas -g PHID.1'  will  yield  the
454       phy identifier of the second descriptor.
455

ENUMERATE

457       The --enumerate option essentially dumps out static information held by
458       this utility. A list of --enumerate variants and their actions follows.
459       For  brevity  subsequent examples of options are shown in their shorter
460       form.
461
462           --enumerate          list generic mode page information
463           -e --all             list generic mode page contents
464                                (i.e. parameters)
465           -e --page=rw         list contents of read write error
466                                recovery mode page
467           -e --inquiry         list VPD pages this utility can decode
468           -e --long            list generic mode pages, transport
469                                protocols, mode pages for each
470                                supported transport protocol and
471                                supported commands
472           -e -l --all          additionally list the contents of
473                                each mode page
474           -e --transport=fcp   list mode pages for the fcp
475                                transport protocol
476           -e -t fcp --all      additionally list the contents of
477                                each mode page
478           -e --vendor=sea      list vendor specific mode pages for
479                                "sea" (Seagate)
480           -e -M sea --all      additionally list the contents of vendor
481                                specific mode pages for "sea" (Seagate)
482           -e -p pcd -l         list contents of SAS phy control and
483                                discovery mode page plus (due to "-l")
484                                some descfriptor format information
485
486       When known mode pages are listed (via  the  --enumerate   option)  each
487       line  starts  with a two or three letter abbreviation. This is followed
488       by the page number (in hex prefixed by "0x") optionally followed  by  a
489       comma  and the subpage number. Finally the descriptive name of the mode
490       page (e.g. as found in SPC-4) is output.
491
492       When known parameters (fields) of a mode page  are  listed,  each  line
493       starts  with an acronym (indented a few spaces). This will match (or be
494       an acronym for) the description for that field  found  in  the  (draft)
495       standards.  Next  are three numbers, separated by colons, surrounded by
496       brackets. These are the start byte (in hex, prefixed by  "0x")  of  the
497       beginning  of  the  field  within  the  mode  page; the starting bit (0
498       through 7 inclusive) and then the number of bits. The descriptive  name
499       of  the parameter (field) is then given. If appropriate the descriptive
500       name includes units (e.g. "(ms)" means  the  units  are  milliseconds).
501       Adding the '-ll' option will list information about possible field val‐
502       ues for selected mode page parameters.
503
504       Mode parameters for which the num_bits is greater than 1 can be  viewed
505       as  unsigned integers. Often 16 and 32 bit fields are set to 0xffff and
506       0xffffffff respectively (all ones) which usually has a special  meaning
507       (see  drafts).  This  utility outputs such values as "-1" to save space
508       (rather than their unsigned integer  equivalents).  "-1"  can  also  be
509       given  as  the value to a mode page field acronym (e.g. '--set=INTT=-1'
510       sets the interval timer field in the Informational  Exceptions  control
511       mode page to 0xffffffff).
512

TRANSPORTS

514       SCSI  transport protocols are a relatively specialized area that can be
515       safely ignored by the majority of users.
516
517       Some transport protocols have protocol specific mode pages.  These  are
518       usually  the  disconnect-reconnect (0x2), the protocol specific logical
519       unit (0x18) and the protocol specific port (0x19) mode pages.  In  some
520       cases the latter mode page has several subpages. The most common trans‐
521       port protocol abbreviations likely to be  used  are  "fcp",  "spi"  and
522       "sas".
523
524       Many  of  the field names are re-used in the same position so the acro‐
525       nym_name namespaces have been divided between generic mode pages  (i.e.
526       when  the  --transport= option is _not_ given) and a namespace for each
527       transport protocol. A LUPID field from the  protocol  specific  logical
528       unit  (0x18)  mode  page and the PPID field from protocol specific port
529       (0x19) mode page are included in the generic modes pages;  this  is  so
530       the  respective  (transport)  protocol identifiers can be seen. In most
531       cases the user will know what the "port" transport is  (i.e.  the  same
532       transport  as the HBA in the computer) but the logical unit's transport
533       could be different.
534

VENDORS

536       SCSI leaves a lot of space for vendor specific information. Often  this
537       is  described  in  product  manuals.  The --vendor=VN (or -M=VN) option
538       allows known vendor specific mode pages to be examined and/or  modified
539       by acronym.
540
541       In  this utility the syntax and semantics of vendor specific mode pages
542       is very similar to those of transport  protocol  specific  mode  pages.
543       Both  cannot  be  specified  together.  Vendor specific modes pages can
544       still be accessed numerically (as shown at the end of the EXAMPLES sec‐
545       tion).
546

COMMANDS

548       The  command  option sends a SCSI command to the DEVICE. If the command
549       fails then this is reflected in the non-zero exit  status.   To  obtain
550       more information about the error use the -v option.
551
552       capacity
553              sends  a  READ  CAPACITY  command  (valid  for  disks and cd/dvd
554              media). If successful yields "blocks: " [the number of  blocks],
555              "block_length:  "  [typically  either  512  or 2048] and "capac‐
556              ity_mib: " [capacity in MibiBytes (1048576 byte units)].
557
558       eject  stops the medium and ejects it from the device.  Note that ejec‐
559              tion  (by  command or button) may be prevented in which case the
560              'unlock' command may be useful in extreme cases.  Typically only
561              appropriate  for  cd/dvd  drives  and disk drives with removable
562              media. Objects if sent to another peripheral  device  type  (but
563              objection can be overridden with '-f' option).
564
565       load   loads  the  medium  and  and  starts it (i.e. spins it up).  See
566              'eject' command for supported device types.
567
568       profile
569              lists the various formats that  a  CD/DVD/HD-DVD/BD  drive  sup‐
570              ports. These are called "profiles" in the MMC standard. The pro‐
571              files are listed one per line.  If media is in  the  drive  then
572              the  profile  that  matches the media (if any) has an "*" to the
573              right of the line.
574
575       ready  sends the "Test Unit Ready" SCSI command to the DEVICE. No error
576              is  reported  if  the device will respond to data requests (e.g.
577              READ) in a reasonable timescale.  For  example,  if  a  disk  is
578              stopped  then  it  will  report  "not ready". All devices should
579              respond to this command.
580
581       sense  sends a REQUEST SENSE command. It reports a  hardware  threshold
582              exceeded,  warning  or  low  power  condition  if  flagged. If a
583              progress indication is present (e.g. during a  format)  then  it
584              will  be output as a percentage. Yields a process status of 0 if
585              the command succeeds and the sense key is 0; else yields 1.  The
586              --quiet option can be used to lessen output, and --hex to output
587              sense data in hex.
588
589       speed=SPEED
590              permits the speed of a CD, DVD, HD_DVD or BD disc in a drive  to
591              be  set  (or  at  least  influenced). It has this format: --com‐
592              mand=speed=SPEED where SPEED is in kilobytes per second. In this
593              case a kilobyte is 1000 bytes. The "times one" speed for a CD is
594              176.4 kB/s, for a DVD is 1350 kB/s and for both HD-DVD and BD it
595              is  4500  kB/s.  If  SPEED  is zero then the drive is set to the
596              speed that it considers gives optimal performance.  This command
597              sends  a  SET  STREAMING multi-media command (MMC) to the drive.
598              The EXACT bit is clear so the drive will round the  given  SPEED
599              as  necessary.   The  command is designed to control read speed;
600              setting write speed should be left to "burning" programs.
601
602       start  starts the medium (i.e. spins it up).  Harmless  if  medium  has
603              already  been  started. See 'eject' command for supported device
604              types. If the DEVICE is an ATA disk in  Linux  the  '--readonly'
605              option may be required.
606
607       stop   stops  the  medium  (i.e. spins it down). Harmless if medium has
608              already been stopped. See 'eject' command for  supported  device
609              types.  If  the  DEVICE is an ATA disk in Linux the '--readonly'
610              option may be required. See the NOTES section above.
611
612       sync   sends a SYNCHRONIZE CACHE command. The device should  flush  any
613              data held in its (volatile) buffers to the media.
614
615       unlock tells  a  device to allow medium removal. It uses the SCSI "pre‐
616              vent allow medium removal" command. This is  desperation  stuff,
617              possibly  overriding a prevention applied by the OS on a mounted
618              file system. The "eject" utility (from the "eject"  package)  is
619              more  graceful  and  should be tried first. This command is only
620              appropriate for devices with removable media.
621
622       For loading and ejecting tapes the mt utility should be used (i.e.  not
623       these commands). The 'ready' command is valid for tape devices.
624

EXAMPLES

626       To list the common (generic) mode parameters of a disk:
627
628          sdparm /dev/sda
629
630       To  list the designators within the device identification VPD page of a
631       disk:
632
633          sdparm --inquiry /dev/sda
634
635       To see all parameters for the caching mode page:
636
637          sdparm --page=ca /dev/sda
638
639       To see all parameters for the caching mode page with parameter descrip‐
640       tions to the right:
641
642          sdparm --page=ca --long /dev/sda
643
644       To get the WCE values (current changeable default and saved) in hex:
645
646          sdparm -g WCE -H /dev/sda
647       0x01 0x00 0x01 0x01
648
649       To get the WCE current value in hex:
650
651          sdparm -g WCE=1 -H /dev/sda
652       0x01
653
654       To set the "Writeback Cache Enable" bit in the current values page:
655
656          sdparm --set=WCE /dev/sda
657
658       To set the "Writeback Cache Enable" bit in the current and saved values
659       page:
660
661          sdparm --set=WCE --save /dev/sda
662
663       To set the "Writeback Cache Enable" and clear "Read Cache Disable":
664
665          sdparm --set=WCE --clear=RCD --save /dev/sda
666
667       The previous example can also by written as:
668
669          sdparm -s WCE=1,RCD=0 -S /dev/sda
670
671       To re-establish the manufacturer's defaults in the  current  and  saved
672       values of the caching mode page:
673
674          sdparm --page=ca --defaults --save /dev/sda
675
676       If  an ATAPI cd/dvd drive is at /dev/hdc then its common (mode) parame‐
677       ters could be listed in the lk 2.6 and 3 series with:
678
679          sdparm /dev/hdc
680
681       If there is a DVD in the drive at /dev/hdc then it could be ejected  in
682       the lk 2.6 and 3 series with:
683
684          sdparm --command=eject /dev/hdc
685
686       If  the  ejection is being prevented by software then that can be over‐
687       ridden with:
688
689          sdparm --command=unlock /dev/hdc
690
691       One disk vendor has a "Performance Mode" bit (PM) in  the  vendor  spe‐
692       cific  unit  attention  mode  page  [0x0,0x0]. PM=0 is server mode (the
693       default) while PM=1 is desktop mode. Desktop mode can be set (both cur‐
694       rent and saved values) with:
695
696          sdparm --page=0 --set=2:7:1=1 --save /dev/sda
697
698       The  resultant  change  can  be  viewed in hex with the --hex option as
699       there are no acronyms for vendor extensions yet. The PM bit is now cov‐
700       ered  by  vendor  specific  mode pages and the above can also be accom‐
701       plished with:
702
703          sdparm --vendor=sea --set=PM --save /dev/sda
704
705       What follows are some examples from Windows using the '--wscan' option.
706       The  idea  is to list the storage device names on the system that might
707       be invoked by other uses of sdparm.
708
709         # sdparm --wscan
710       PD0     [C]     FUJITSU   MHY2160BH         0000
711       PD1     [DF]    WD        2500BEV External  1.05  WD-WXE90
712       CDROM0  [E]     MATSHITA DVD/CDRW UJDA775  CB03
713
714       So 'sdparm -a CDROM0' and 'sdparm -a E' will show all the (known)  mode
715       page  fields  for  the  Matshita  DVD/CD drive. By using the '--wsacan'
716       option twice, the bus type (as seen by the OS) is added to the output:
717
718         # sdparm -ww
719       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
720       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
721       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
722
723       And the pattern continues to add a SCSI adapter scan. This may be  use‐
724       ful if there are specialized storage related devices (e.g. a SES device
725       in an enclosure) but does add much extra information in this case.
726
727         # sdparm -www
728       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
729       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
730       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
731
732       SCSI0:0,0,0   claimed=1 pdt=0h  FUJITSU   MHY2160BH         0000
733       SCSI1:0,0,0   claimed=1 pdt=5h  MATSHITA  DVD/CDRW UJDA775  CB03
734

EXIT STATUS

736       To aid scripts that call sdparm, the exit status  is  set  to  indicate
737       success  (0) or failure (1 or more). Note that some of the lower values
738       correspond to the SCSI sense key values. The exit status values are:
739
740       0      success
741
742       1      syntax error. Either illegal command line options, options  with
743              bad arguments or a combination of options that is not permitted.
744
745       2      the  DEVICE  reports  that  it  is  not  ready for the operation
746              requested. The device may be in the process  of  becoming  ready
747              (e.g.   spinning  up  but  not at speed) so the utility may work
748              after a wait.
749
750       3      the DEVICE reports a  medium  or  hardware  error  (or  a  blank
751              check).  For  example  an attempt to read a corrupted block on a
752              disk will yield this value.
753
754       5      the DEVICE reports an "illegal request" with an additional sense
755              code  other  than "invalid operation code". This is often a sup‐
756              ported command with a field set requesting an unsupported  capa‐
757              bility.  For commands that require a "service action" field this
758              value can indicate that the command is not supported.
759
760       6      the DEVICE reports a "unit attention"  condition.  This  usually
761              indicates  that something unrelated to the requested command has
762              occurred (e.g. a device reset) potentially  before  the  current
763              SCSI  command  was sent. The requested command has not been exe‐
764              cuted by the device. Note that  unit  attention  conditions  are
765              usually only reported once by a device.
766
767       9      the  DEVICE  reports an illegal request with an additional sense
768              code of "invalid operation code" which  means  that  it  doesn't
769              support the requested command.
770
771       11     the  DEVICE  reports  an  aborted command. In some cases aborted
772              commands can be  retried  immediately  (e.g.  if  the  transport
773              aborted the command due to congestion).
774
775       15     the  utility  is  unable to open, close or use the given DEVICE.
776              The given file name could be incorrect or there may  be  permis‐
777              sion problems. Adding the -v option may give more information.
778
779       20     the  DEVICE  reports  it  has  a check condition but "no sense".
780              Some polling commands (e.g. REQUEST SENSE) can react  this  way.
781              It is unlikely that this value will occur as an exit status.
782
783       21     the  DEVICE  reports  a "recovered error". The requested command
784              was successful. Most likely a utility will  report  a  recovered
785              error  to stderr and continue, probably leaving the utility with
786              an exit status of 0 .
787
788       24     the DEVICE reports a SCSI status of "reservation conflict". This
789              means  access  to  the  DEVICE with the current command has been
790              blocked because another machine (HBA or SCSI "initiator")  holds
791              a  reservation  on  this  DEVICE. On modern SCSI systems this is
792              related to the use of the PERSISTENT RESERVATION family of  com‐
793              mands.
794
795       25     the  DEVICE  reports a SCSI status of "condition met". Currently
796              only the PRE-FETCH command (see SBC-4) yields this status.
797
798       26     the DEVICE reports a SCSI status of "busy". SAM-5  defines  this
799              status  as  the  logical unit is temporarily unable to process a
800              command.  It is recommended to re-issue the command.
801
802       27     the DEVICE reports a SCSI status of "task set full".
803
804       28     the DEVICE reports a SCSI status of "ACA active". ACA  is  "auto
805              contingent allegiance" and is seldom used.
806
807       29     the  DEVICE reports a SCSI status of "task aborted". SAM-5 says:
808              "This status shall be returned if a command is aborted by a com‐
809              mand  or  task  management function on another I_T nexus and the
810              Control mode page TAS bit is set to one".
811
812       33     the command sent to DEVICE has timed out. This occurs  in  Linux
813              only;  in  other ports a command timeout will appear as a trans‐
814              port (or OS) error.
815
816       97     the response to a SCSI command failed sanity checks.
817
818       98     the DEVICE reports it  has  a  check  condition  but  the  error
819              doesn't fit into any of the above categories.
820
821       99     any  errors  that  can't  be categorized into values 1 to 98 may
822              yield this value. This includes transport and  operating  system
823              errors after the command has been sent to the device.
824
825       Most  of  the  error  conditions  reported above will be repeatable (an
826       example of one that is not is "unit attention") so the utility  can  be
827       run again with the -v option (or several) to obtain more information.
828

AUTHORS

830       Written by Douglas Gilbert.
831

REPORTING BUGS

833       Report bugs to <dgilbert at interlog dot com>.
834
836       Copyright © 2005-2016 Douglas Gilbert
837       This  software is distributed under a FreeBSD license. There is NO war‐
838       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
839       POSE.
840

WEB SITE

842       There     is    a    web    page    discussing    this    package    at
843       http://sg.danny.cz/sg/sdparm.html .
844

SEE ALSO

846       hdparm(hdparm), sg_modes, sg_wr_mode,  sginfo,  sg_inq,  sg_vpd(all  in
847       sg3_utils),      smartmontools(smartmontools.sourceforge.net),      mt,
848       eject(eject),
849
850
851
852sdparm-1.10                      February 2016                       SDPARM(8)
Impressum