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. This
216              option may be useful if a command is being sent to an  ATA  disk
217              via  a  SCSI  command  set.  For  example in Linux '-C stop' may
218              require this option to stop an ATA disk being restarted  immedi‐
219              ately.
220
221       -S, --save
222              when  a  mode  page  is being modified (by using the --clear=STR
223              and/or --set=STR options) then the default action is  to  modify
224              only  the  current  values  mode page. When this option is given
225              then the corresponding value(s) in the saved values mode page is
226              also  changed.  The  next  time  the  device is power cycled (or
227              reset) the saved values mode page becomes (i.e.  is  copied  to)
228              the current values mode page. See NOTES section below.
229
230       -s, --set=STR
231              in  its  simplest  form  STR  contains a field acronym_name or a
232              field numerical descriptor. In the absence of an explicit value,
233              each  acronym_name has its value set to (all) ones. This means a
234              16 bit field will be set to 0xffff which is  65535  in  decimal.
235              Alternatively  each  acronym_name or numerical descriptor may be
236              followed by "=<n>" where <n> is the value to set that field  to.
237              See the PARAMETERS section below.
238
239       -6, --six
240              The  default  action  of this utility is to issue MODE SENSE and
241              MODE SELECT SCSI commands with 10 byte cdbs. When this option is
242              given the 6 byte cdb variants are used. RBC and old SCSI devices
243              may need this option. This utility outputs a suggestion  to  use
244              this  option  if  the SCSI status indicates that the 10 byte cdb
245              variant is not supported.
246
247       -t, --transport=TN
248              Specifies the transport protocol where TN is either a number  in
249              the range 0 to 15 (inclusive) or an abbreviation (e.g. "fcp" for
250              the Fibre Channel Protocol). One way to list available transport
251              protocols  numbers and their associated abbreviations is to give
252              an invalid transport protocol number such as '-t x'; another way
253              is '-e -l'.
254
255       -M, --vendor=VN
256              Specifies  the  vendor  (i.e. manufacturer) where VN is either a
257              number (0 or more) or an abbreviation (e.g.  "sea"  for  Seagate
258              disk vendor specific).  One way to list available vendor numbers
259              and their associated abbreviations is to give an invalid  vendor
260              number such as '-M x'; another way is '-e -l'.
261
262       -v, --verbose
263              increase  the  level  of verbosity, (i.e. debug output). In some
264              cases more decoding is  done  (e.g.  fields  within  a  standard
265              INQUIRY response).
266
267       -V, --version
268              print the version string and then exit.
269
270       -w, --wscan
271              this  option  is  available  in  Windows  only. It lists storage
272              device names and the corresponding volumes, if  any.  When  used
273              twice  it  adds  the "bus type" of the closest transport (e.g. a
274              SATA disk in a USB connected enclosure has bus type  Usb).  When
275              used  three  times  a SCSI adapter scan is added. When used four
276              times only a SCSI adapter scan is shown.  See examples below and
277              the "Win32 port" section in the README file.
278

NOTES

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

PARAMETERS

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

ENUMERATE

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

TRANSPORTS

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

VENDORS

453       SCSI leaves a lot of space for vendor specific information. Often  this
454       is  described  in  product  manuals.  The --vendor=VN (or -M=VN) option
455       allows known vendor specific mode pages to be examined and/or  modified
456       by acronym.
457
458       In  this utility the syntax and semantics of vendor specific mode pages
459       is very similar to those of transport  protocol  specific  mode  pages.
460       Both  cannot  be  specified  together.  Vendor specific modes pages can
461       still be accessed numerically (as shown at the end of the EXAMPLES sec‐
462       tion).
463

COMMANDS

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

EXAMPLES

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

EXIT STATUS

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

AUTHORS

723       Written by Douglas Gilbert.
724

REPORTING BUGS

726       Report bugs to <dgilbert at interlog dot com>.
727
729       Copyright © 2005-2010 Douglas Gilbert
730       This  software is distributed under a FreeBSD license. There is NO war‐
731       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
732       POSE.
733

WEB SITE

735       There     is    a    web    page    discussing    this    package    at
736       http://sg.danny.cz/sg/sdparm.html .
737

SEE ALSO

739       hdparm(hdparm),   sg_modes,   sg_wr_mode,   sginfo,   sg_inq,   sg_vpd,
740       sg_scan(all    in    sg3_utils),    smartmontools(smartmontools.source‐
741       forge.net), mt, eject(eject),
742
743
744
745sdparm-1.06                        July 2010                         SDPARM(8)
Impressum