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]  [--clear=STR]  [--command=CMD]  [--dbd]   [--defaults]
11       [--dummy]   [--flexible]   [--get=STR]   [--help]  [--hex]  [--inquiry]
12       [--long] [--num-desc] [--page=PG[,SPG]] [--quiet] [--readonly] [--save]
13       [--set=STR]  [--six] [--transport=TN] [--vendor=VN] [--verbose] [--ver‐
14       sion] DEVICE [DEVICE...]
15
16       sdparm  --enumerate  [--all]  [--inquiry]  [--long]   [--page=PG[,SPG]]
17       [--transport=TN] [--vendor=VN]
18
19       sdparm --wscan [--verbose]
20

DESCRIPTION

22       This  utility  fetches and potentially changes SCSI device (e.g.  disk)
23       mode pages. Inquiry data including Vital Product Data (VPD)  pages  can
24       also  be  displayed. Commands associated with starting and stopping the
25       medium; loading and unloading the medium; and other housekeeping  func‐
26       tion may also be issued by this utility.
27
28       Of  the  three invocations shown in the synopsis, the first is the most
29       general. The second variant that uses --enumerate is for dumping infor‐
30       mation  held  in sdparm's internal tables. The last variant is for Win‐
31       dows only and lists the available device names; see the  OPTIONS  entry
32       for --wscan.
33
34       If  no options (other than DEVICE) are given then a selection of common
35       mode page fields for that device are listed. If the  --long  option  is
36       also  given  then a description of the fields is placed on the right of
37       each line. If the --all option is given then all known mode page fields
38       for that device are listed. Individual fields can be displayed with the
39       --get=STR option (e.g. '--get=WCE' to fetch the state of the  Writeback
40       Cache Enable field).
41
42       This  utility  completes  with an exit status of 0 when successful. For
43       other values see the EXIT STATUS section below.
44
45       One or more DEVICE arguments can be given. The utility will essentially
46       apply  the  given  options  to each DEVICE in the list.  If an error is
47       detected, it is noted and the utility continues.  Error value  5  (file
48       open  or  close problem) is treated as lower priority when other errors
49       are detected. The exit status is the most recently detected error value
50       (excluding  error  value  5 if other errors have been detected). If all
51       actions succeed the exit status is zero.
52
53       By default this utility shows mode pages that are common to all  trans‐
54       port  protocols. These are termed as "generic" mode pages.  If there is
55       no match on a generic mode page name or field then those pages specific
56       to  the  SAS  transport  are checked.  Transport protocol specific mode
57       pages are selected with the --transport=TN option.  See  the  TRANSPORT
58       section below.  Vendor specific mode pages are selected with the --ven‐
59       dor=VN option.  See the VENDORS section below.
60
61       Although originally for SCSI disks (or storage devices that  appear  to
62       the  OS as SCSI disks) many of the mode pages are for other SCSI device
63       types.  These include CD/DVD players that use the ATAPI (or any  other)
64       transport, SCSI tapes drives and SCSI enclosures.
65
66       When  the  --inquiry  option  is  given  without a page number then the
67       Device Identification VPD page (page number 0x83) is requested  and  if
68       found  it  is  decoded  and  output. If no page number is given and the
69       --all option is given then a list of VPD page names (but not their con‐
70       tents)  supported  by the DEVICE is output. When both the --inquiry and
71       --page=PG options are given then the VPD page can be  specified  as  an
72       abbreviation  (e.g.  "sp"  for  the SCSI ports VPD page) or numerically
73       (e.g. "0x88"). If a VPD page is returned by the DEVICE but sdparm  can‐
74       not decode it or the --hex option is given then it is output in hex.
75

OPTIONS

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

NOTES

282       The  reference  document  used for interpreting mode and VPD pages (and
283       the INQUIRY standard response) is T10/1713-D Revision  36e  (SPC-4,  24
284       August  2012) found at http://www.t10.org . Obsolete and reserved items
285       in the standard INQUIRY response output are displayed in brackets.
286
287       A mode page for which no abbreviation is known (e.g. a vendor  specific
288       mode page) can be listed in hexadecimal by using the option combination
289       '--page=PG --hex'.
290
291       Numbers input to sdparm  (e.g.  in  the  command  line  arguments)  are
292       assumed  to  be  in  decimal unless there is a hexadecimal indicator. A
293       hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C lan‐
294       guage convention) or a trailing 'h' or 'H' (i.e. the convention used at
295       www.t10.org ). In the case of --page= either  a  string  or  number  is
296       expected,  so  hex  numbers like 'ch' (12) should be prefixed by a zero
297       (e.g. '0ch').
298
299       The SPC-4 draft (rev 2) says that devices that implement no distinction
300       between  current  and saved pages can return an error (ILLEGAL REQUEST,
301       invalid field in cdb) if the SP bit (which corresponds  to  the  --save
302       option)  is  _not_  set.  In  such  cases the --save option needs to be
303       given.
304
305       If the --save option is given but the existing mode page indicates (via
306       its  PS  bit) that the page is not savable, then this utility generates
307       an error message. That message suggests to try again without the --save
308       option.
309
310       Since  the  device  identification  VPD page (acronym_name "di") poten‐
311       tially contains  a  lot  of  diverse  designators,  several  associated
312       acronyms  are  available.  They  are "di_lu" for designators associated
313       with the addressed logical unit, "di_port" for  designators  associated
314       with  the  target  port (which the command arrived via) and "di_target"
315       for designators associated with the target device. When  "di"  is  used
316       designators  are  grouped  by lu, then port and then target device.  To
317       see all designators decoded in the order that they appear  in  the  VPD
318       page use "di_asis".
319
320       Only  those  VPD  pages defined by t10.org are decoded by this utility.
321       SPC-4 sets aside VPD pages codes from 0xc0 to 0xff (inclusive) for ven‐
322       dor specific pages some of which are decoded in the sg_vpd utility.
323
324       In  the linux kernel 2.6 series any device node that understands a SCSI
325       command set (e.g. SCSI disks and CD/DVD drives) may be specified.  More
326       precisely the driver that "owns" the device node must support the SG_IO
327       ioctl. In the lk 2.4 series only SCSI generic (sg) device nodes support
328       the  SG_IO  ioctl. However in the lk 2.4 series other SCSI device nodes
329       are mapped within this utility to their corresponding sg device  nodes.
330       So if there is a SCSI disk at /dev/sda then 'sdparm /dev/sda' will work
331       in both the lk 2.6 and lk 2.4 series. However  if  there  is  an  ATAPI
332       cd/dvd  drive  at /dev/hdc then 'sdparm /dev/hdc' will only work in the
333       lk 2.6 series.
334
335       In the Linux 2.6 series, especially with ATA  disks,  using  sdparm  to
336       stop (spin down) a disk may not be sufficient and other mechanisms will
337       start the disk again some time later. The user might additionally  mark
338       the disk as "offline" with 'echo offline > /sys/block/sda/device/state'
339       where sda is the block name of the disk. To restart the disk  "offline"
340       can be replaced with "running".
341

PARAMETERS

343       In  their  simplest  form  the  --clear=, --get= and --set= options (or
344       their short forms) take an acronym_name such as "WCE". In the  case  of
345       '--get=WCE'  the  value of "Writeback Cache Enable" in the caching mode
346       page will be fetched. In the case of '--set=WCE' that bit will  be  set
347       (to  one).  In  the  case of '--clear=WCE' that bit will be cleared (to
348       zero). When an acronym_name is given then the mode page is imputed from
349       that acronym_name (e.g. WCE is in the caching mode page).
350
351       Instead  of an acronym_name a field within a mode page can be described
352       numerically with a <start_byte>:<start_bit>:<num_bits> tuple. These are
353       the <start_byte> (origin 0) within the mode page, a <start_bit> (0 to 7
354       inclusive) and <num_bits> (1 to 64 inclusive).  For  example,  the  low
355       level representation of the RCD bit (the "Read Cache Disable bit in the
356       caching mode page) is "2:0:1". The <start_byte> can optionally be given
357       in  hex  (e.g.  '--set=0x2:0:1'  or '--set=2h:0:1'). With this form the
358       --page= option is required to establish which mode page is to be used.
359
360       Either form can optionally be followed by "=<val>". By default <val> is
361       decimal  but  can  be given in hex in the normal fashion. Here are some
362       examples: '--set=2h:0:1=1h' and '-s MRIE=0x3'. When the acronym_name or
363       numeric  form following --clear= is not given an explicit '=<val>' then
364       the value defaults to zero. When the acronym_name or numeric form  fol‐
365       lowing --set= is not given an explicit '=<val>' then the value defaults
366       to "all ones"  (i.e.  as  many  as  <num_bits>  permits).  For  example
367       '--clear=WCE'  and  '--clear=WCE=0' have the same meaning: clear Write‐
368       back Cache Enable or, put more simply: turn off the writeback cache.
369
370       Multiple fields within the same mode page can be changed  by  giving  a
371       comma  separated  list  of acronym_names and/or the numerical form. For
372       example: '--set=TEST,MRIE=6'.
373
374       Some mode page have multiple descriptors. They typically have  a  fixed
375       header section at the start of the mode page that includes a field con‐
376       taining the number of descriptors that follow. Following the header  is
377       a variable number of descriptors. An example is the SAS Phy Control and
378       Discover mode page. An acronym_name may  include  a  trailing  '.<num>'
379       where "<num>" is a descriptor number (origin 0). For example '-t sas -g
380       PHID.0' and '-t sas -g PHID' will yield the phy identifier of the first
381       descriptor  of  the  above mode page; '-t sas -g PHID.1' will yield the
382       phy identifier of the second descriptor.
383

ENUMERATE

385       The --enumerate option essentially dumps out static information held by
386       this utility. A list of --enumerate variants and their actions follows.
387       For brevity subsequent examples of options are shown in  their  shorter
388       form.
389
390           --enumerate          list generic mode page information
391           -e --all             list generic mode page contents
392                                (i.e. parameters)
393           -e --page=rw         list contents of read write error
394                                recovery mode page
395           -e --inquiry         list VPD pages this utility can decode
396           -e --long            list generic mode pages, transport
397                                protocols, mode pages for each
398                                supported transport protocol and
399                                supported commands
400           -e -l --all          additionally list the contents of
401                                each mode page
402           -e --transport=fcp   list mode pages for the fcp
403                                transport protocol
404           -e -t fcp --all      additionally list the contents of
405                                each mode page
406           -e --vendor=sea      list vendor specific mode pages for
407                                "sea" (Seagate)
408           -e -M sea --all      additionally list the contents of vendor
409                                specific mode pages for "sea" (Seagate)
410           -e -p pcd -l         list contents of SAS phy control and
411                                discovery mode page plus (due to "-l")
412                                some descfriptor format information
413
414       When  known  mode  pages  are listed (via the --enumerate  option) each
415       line starts with a two or three letter abbreviation. This  is  followed
416       by  the  page number (in hex prefixed by "0x") optionally followed by a
417       comma and the subpage number. Finally the descriptive name of the  mode
418       page (e.g. as found in SPC-4) is output.
419
420       When  known  parameters  (fields)  of a mode page are listed, each line
421       starts with an acronym (indented a few spaces). This will match (or  be
422       an  acronym  for)  the  description for that field found in the (draft)
423       standards. Next are three numbers, separated by colons,  surrounded  by
424       brackets.  These  are  the start byte (in hex, prefixed by "0x") of the
425       beginning of the field within  the  mode  page;  the  starting  bit  (0
426       through  7 inclusive) and then the number of bits. The descriptive name
427       of the parameter (field) is then given. If appropriate the  descriptive
428       name  includes  units  (e.g.  "(ms)" means the units are milliseconds).
429       Adding the '-ll' option will list information about possible field val‐
430       ues for selected mode page parameters.
431
432       Mode  parameters for which the num_bits is greater than 1 can be viewed
433       as unsigned integers. Often 16 and 32 bit fields are set to 0xffff  and
434       0xffffffff  respectively (all ones) which usually has a special meaning
435       (see drafts). This utility outputs such values as "-1"  to  save  space
436       (rather  than  their  unsigned  integer  equivalents). "-1" can also be
437       given as the value to a mode page field acronym  (e.g.  '--set=INTT=-1'
438       sets  the  interval timer field in the Informational Exceptions control
439       mode page to 0xffffffff).
440

TRANSPORTS

442       SCSI transport protocols are a relatively specialized area that can  be
443       safely ignored by the majority of users.
444
445       Some  transport  protocols have protocol specific mode pages. These are
446       usually the disconnect-reconnect (0x2), the protocol  specific  logical
447       unit  (0x18)  and the protocol specific port (0x19) mode pages. In some
448       cases the latter mode page has several subpages. The most common trans‐
449       port  protocol  abbreviations  likely  to  be used are "fcp", "spi" and
450       "sas".
451
452       Many of the field names are re-used in the same position so  the  acro‐
453       nym_name  namespaces have been divided between generic mode pages (i.e.
454       when the --transport= option is _not_ given) and a namespace  for  each
455       transport  protocol.  A  LUPID field from the protocol specific logical
456       unit (0x18) mode page and the PPID field from  protocol  specific  port
457       (0x19)  mode  page  are included in the generic modes pages; this is so
458       the respective (transport) protocol identifiers can be  seen.  In  most
459       cases  the  user  will know what the "port" transport is (i.e. the same
460       transport as the HBA in the computer) but the logical unit's  transport
461       could be different.
462

VENDORS

464       SCSI  leaves a lot of space for vendor specific information. Often this
465       is described in product manuals.  The  --vendor=VN  (or  -M=VN)  option
466       allows  known vendor specific mode pages to be examined and/or modified
467       by acronym.
468
469       In this utility the syntax and semantics of vendor specific mode  pages
470       is  very  similar  to  those of transport protocol specific mode pages.
471       Both cannot be specified together.  Vendor  specific  modes  pages  can
472       still be accessed numerically (as shown at the end of the EXAMPLES sec‐
473       tion).
474

COMMANDS

476       The command option sends a SCSI command to the DEVICE. If  the  command
477       fails  then  this  is reflected in the non-zero exit status.  To obtain
478       more information about the error use the -v option.
479
480       capacity
481              sends a READ  CAPACITY  command  (valid  for  disks  and  cd/dvd
482              media).  If successful yields "blocks: " [the number of blocks],
483              "block_length: " [typically either  512  or  2048]  and  "capac‐
484              ity_mib: " [capacity in MibiBytes (1048576 byte units)].
485
486       eject  stops the medium and ejects it from the device.  Note that ejec‐
487              tion (by command or button) may be prevented in which  case  the
488              'unlock' command may be useful in extreme cases.  Typically only
489              appropriate for cd/dvd drives and  disk  drives  with  removable
490              media.  Objects  if  sent to another peripheral device type (but
491              objection can be overridden with '-f' option).
492
493       load   loads the medium and and starts it  (i.e.  spins  it  up).   See
494              'eject' command for supported device types.
495
496       profile
497              lists  the  various  formats  that a CD/DVD/HD-DVD/BD drive sup‐
498              ports. These are called "profiles" in the MMC standard. The pro‐
499              files  are  listed  one per line.  If media is in the drive then
500              the profile that matches the media (if any) has an  "*"  to  the
501              right of the line.
502
503       ready  sends the "Test Unit Ready" SCSI command to the DEVICE. No error
504              is reported if the device will respond to  data  requests  (e.g.
505              READ)  in  a  reasonable  timescale.  For  example, if a disk is
506              stopped then it will report  "not  ready".  All  devices  should
507              respond to this command.
508
509       sense  sends  a  REQUEST SENSE command. It reports a hardware threshold
510              exceeded, warning or  low  power  condition  if  flagged.  If  a
511              progress  indication  is  present (e.g. during a format) then it
512              will be output as a percentage. Yields a process status of 0  if
513              the  command succeeds and the sense key is 0; else yields 1. The
514              --quiet option can be used to lessen output, and --hex to output
515              sense data in hex.
516
517       speed=SPEED
518              permits  the speed of a CD, DVD, HD_DVD or BD disc in a drive to
519              be set (or at least influenced).  It  has  this  format:  --com‐
520              mand=speed=SPEED where SPEED is in kilobytes per second. In this
521              case a kilobyte is 1000 bytes. The "times one" speed for a CD is
522              176.4 kB/s, for a DVD is 1350 kB/s and for both HD-DVD and BD it
523              is 4500 kB/s. If SPEED is zero then the  drive  is  set  to  the
524              speed that it considers gives optimal performance.  This command
525              sends a SET STREAMING multi-media command (MMC)  to  the  drive.
526              The  EXACT  bit is clear so the drive will round the given SPEED
527              as necessary.  The command is designed to  control  read  speed;
528              setting write speed should be left to "burning" programs.
529
530       start  starts  the  medium  (i.e.  spins it up). Harmless if medium has
531              already been started. See 'eject' command for  supported  device
532              types.  If  the  DEVICE is an ATA disk in Linux the '--readonly'
533              option may be required.
534
535       stop   stops the medium (i.e. spins it down). Harmless  if  medium  has
536              already  been  stopped. See 'eject' command for supported device
537              types. If the DEVICE is an ATA disk in  Linux  the  '--readonly'
538              option may be required. See the NOTES section above.
539
540       sync   sends  a  SYNCHRONIZE CACHE command. The device should flush any
541              data held in its (volatile) buffers to the media.
542
543       unlock tells a device to allow medium removal. It uses the  SCSI  "pre‐
544              vent  allow  medium removal" command. This is desperation stuff,
545              possibly overriding a prevention applied by the OS on a  mounted
546              file  system.  The "eject" utility (from the "eject" package) is
547              more graceful and should be tried first. This  command  is  only
548              appropriate for devices with removable media.
549
550       For  loading and ejecting tapes the mt utility should be used (i.e. not
551       these commands). The 'ready' command is valid for tape devices.
552

EXAMPLES

554       To list the common (generic) mode parameters of a disk:
555
556          sdparm /dev/sda
557
558       To list the designators within the device identification VPD page of  a
559       disk:
560
561          sdparm --inquiry /dev/sda
562
563       To see all parameters for the caching mode page:
564
565          sdparm --page=ca /dev/sda
566
567       To see all parameters for the caching mode page with parameter descrip‐
568       tions to the right:
569
570          sdparm --page=ca --long /dev/sda
571
572       To get the WCE values (current changeable default and saved) in hex:
573
574          sdparm -g WCE -H /dev/sda
575       0x01 0x00 0x01 0x01
576
577       To get the WCE current value in hex:
578
579          sdparm -g WCE=1 -H /dev/sda
580       0x01
581
582       To set the "Writeback Cache Enable" bit in the current values page:
583
584          sdparm --set=WCE /dev/sda
585
586       To set the "Writeback Cache Enable" bit in the current and saved values
587       page:
588
589          sdparm --set=WCE --save /dev/sda
590
591       To set the "Writeback Cache Enable" and clear "Read Cache Disable":
592
593          sdparm --set=WCE --clear=RCD --save /dev/sda
594
595       The previous example can also by written as:
596
597          sdparm -s WCE=1,RCD=0 -S /dev/sda
598
599       To  re-establish  the  manufacturer's defaults in the current and saved
600       values of the caching mode page:
601
602          sdparm --page=ca --defaults --save /dev/sda
603
604       If an ATAPI cd/dvd drive is at /dev/hdc then its common (mode)  parame‐
605       ters could be listed in the lk 2.6 series with:
606
607          sdparm /dev/hdc
608
609       If  there is a DVD in the drive at /dev/hdc then it could be ejected in
610       the lk 2.6 series with:
611
612          sdparm --command=eject /dev/hdc
613
614       If the ejection is being prevented by software then that can  be  over‐
615       ridden with:
616
617          sdparm --command=unlock /dev/hdc
618
619       One  disk  vendor  has a "Performance Mode" bit (PM) in the vendor spe‐
620       cific unit attention mode page [0x0,0x0].  PM=0  is  server  mode  (the
621       default) while PM=1 is desktop mode. Desktop mode can be set (both cur‐
622       rent and saved values) with:
623
624          sdparm --page=0 --set=2:7:1=1 --save /dev/sda
625
626       The resultant change can be viewed in hex  with  the  --hex  option  as
627       there are no acronyms for vendor extensions yet. The PM bit is now cov‐
628       ered by vendor specific mode pages and the above  can  also  be  accom‐
629       plished with:
630
631          sdparm --vendor=sea --set=PM --save /dev/sda
632
633       What follows are some examples from Windows using the '--wscan' option.
634       The idea is to list the storage device names on the system  that  might
635       be invoked by other uses of sdparm.
636
637         # sdparm --wscan
638       PD0     [C]     FUJITSU   MHY2160BH         0000
639       PD1     [DF]    WD        2500BEV External  1.05  WD-WXE90
640       CDROM0  [E]     MATSHITA DVD/CDRW UJDA775  CB03
641
642       So  'sdparm -a CDROM0' and 'sdparm -a E' will show all the (known) mode
643       page fields for the Matshita DVD/CD  drive.  By  using  the  '--wsacan'
644       option twice, the bus type (as seen by the OS) is added to the output:
645
646         # sdparm -ww
647       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
648       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
649       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
650
651       And  the pattern continues to add a SCSI adapter scan. This may be use‐
652       ful if there are specialized storage related devices (e.g. a SES device
653       in an enclosure) but does add much extra information in this case.
654
655         # sdparm -www
656       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
657       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
658       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
659
660       SCSI0:0,0,0   claimed=1 pdt=0h  FUJITSU   MHY2160BH         0000
661       SCSI1:0,0,0   claimed=1 pdt=5h  MATSHITA  DVD/CDRW UJDA775  CB03
662

EXIT STATUS

664       To  aid  scripts  that  call sdparm, the exit status is set to indicate
665       success (0) or failure (1 or more). Note that some of the lower  values
666       correspond to the SCSI sense key values. The exit status values are:
667
668       0      success
669
670       1      syntax  error. Either illegal command line options, options with
671              bad arguments or a combination of options that is not permitted.
672
673       2      the DEVICE reports that  it  is  not  ready  for  the  operation
674              requested.  The  device  may be in the process of becoming ready
675              (e.g.  spinning up but not at speed) so  the  utility  may  work
676              after a wait.
677
678       3      the  DEVICE  reports  a  medium  or  hardware  error (or a blank
679              check). For example an attempt to read a corrupted  block  on  a
680              disk will yield this value.
681
682       5      the DEVICE reports an "illegal request" with an additional sense
683              code other than "invalid operation code". This is often  a  sup‐
684              ported  command with a field set requesting an unsupported capa‐
685              bility. For commands that require a "service action" field  this
686              value can indicate that the command is not supported.
687
688       6      the  DEVICE  reports  a "unit attention" condition. This usually
689              indicates that something unrelated to the requested command  has
690              occurred  (e.g.  a  device reset) potentially before the current
691              SCSI command was sent. The requested command has not  been  exe‐
692              cuted  by  the  device.  Note that unit attention conditions are
693              usually only reported once by a device.
694
695       9      the DEVICE reports an illegal request with an  additional  sense
696              code  of  "invalid  operation  code" which means that it doesn't
697              support the requested command.
698
699       11     the DEVICE reports an aborted command.  In  some  cases  aborted
700              commands  can  be  retried  immediately  (e.g.  if the transport
701              aborted the command due to congestion).
702
703       15     the utility is unable to open, close or use  the  given  DEVICE.
704              The  given  file name could be incorrect or there may be permis‐
705              sion problems. Adding the -v option may give more information.
706
707       20     the DEVICE reports it has a  check  condition  but  "no  sense".
708              Some  polling  commands (e.g. REQUEST SENSE) can react this way.
709              It is unlikely that this value will occur as an exit status.
710
711       21     the DEVICE reports a "recovered error".  The  requested  command
712              was  successful.  Most  likely a utility will report a recovered
713              error to stderr and continue, probably leaving the utility  with
714              an exit status of 0 .
715
716       33     the  command  sent to DEVICE has timed out. This occurs in Linux
717              only; in other ports a command timeout will appear as  a  trans‐
718              port (or OS) error.
719
720       97     the response to a SCSI command failed sanity checks.
721
722       98     the  DEVICE  reports  it  has  a  check  condition but the error
723              doesn't fit into any of the above categories.
724
725       99     any errors that can't be categorized into values  1  to  98  may
726              yield  this  value. This includes transport and operating system
727              errors after the command has been sent to the device.
728
729       Most of the error conditions reported  above  will  be  repeatable  (an
730       example  of  one that is not is "unit attention") so the utility can be
731       run again with the -v option (or several) to obtain more information.
732

AUTHORS

734       Written by Douglas Gilbert.
735

REPORTING BUGS

737       Report bugs to <dgilbert at interlog dot com>.
738
740       Copyright © 2005-2013 Douglas Gilbert
741       This software is distributed under a FreeBSD license. There is NO  war‐
742       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
743       POSE.
744

WEB SITE

746       There    is    a    web    page    discussing    this    package     at
747       http://sg.danny.cz/sg/sdparm.html .
748

SEE ALSO

750       hdparm(hdparm),  sg_modes,  sg_wr_mode,  sginfo,  sg_inq, sg_vpd(all in
751       sg3_utils),      smartmontools(smartmontools.sourceforge.net),      mt,
752       eject(eject),
753
754
755
756sdparm-1.08                        June 2013                         SDPARM(8)
Impressum