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] [--save]  [--set=STR]
13       [--six] [--transport=TN] [--vendor=VN] [--verbose] [--version] DEVICE
14
15       sdparm   --enumerate  [--all]  [--inquiry]  [--long]  [--page=PG[,SPG]]
16       [--transport=TN] [--vendor=VN]
17
18       sdparm --wscan [--verbose]
19

DESCRIPTION

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

OPTIONS

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

NOTES

262       A mode page for which no abbreviation is known (e.g. a vendor  specific
263       mode page) can be listed in hexadecimal by using the option combination
264       '--page=PG --hex'.
265
266       Numbers input to sdparm  (e.g.  in  the  command  line  arguments)  are
267       assumed  to  be  in  decimal unless there is a hexadecimal indicator. A
268       hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C lan‐
269       guage convention) or a trailing 'h' or 'H' (i.e. the convention used at
270       www.t10.org ). In the case of --page= either  a  string  or  number  is
271       expected,  so  hex  numbers like 'ch' (12) should be prefixed by a zero
272       (e.g. '0ch').
273
274       The SPC-4 draft (rev 2) says that devices that implement no distinction
275       between  current  and saved pages can return an error (ILLEGAL REQUEST,
276       invalid field in cdb) if the SP bit (which corresponds  to  the  --save
277       option)  is  _not_  set.  In  such  cases the --save option needs to be
278       given.
279
280       If the --save option is given but the existing mode page indicates (via
281       its  PS  bit) that the page is not savable, then this utility generates
282       an error message. That message suggests to try again without the --save
283       option.
284
285       Since  the  device  identification  VPD page (acronym_name "di") poten‐
286       tially contains  a  lot  of  diverse  designators,  several  associated
287       acronyms  are  available.  They  are "di_lu" for designators associated
288       with the addressed logical unit, "di_port" for  designators  associated
289       with  the  target  port (which the command arrived via) and "di_target"
290       for designators associated with the target device. When  "di"  is  used
291       designators  are  grouped  by lu, then port and then target device.  To
292       see all designators decoded in the order that they appear  in  the  VPD
293       page use "di_asis".
294
295       In  the linux kernel 2.6 series any device node that understands a SCSI
296       command set (e.g. SCSI disks and CD/DVD drives) may be specified.  More
297       precisely the driver that "owns" the device node must support the SG_IO
298       ioctl. In the lk 2.4 series only SCSI generic (sg) device nodes support
299       the  SG_IO  ioctl. However in the lk 2.4 series other SCSI device nodes
300       are mapped within this utility to their corresponding sg device  nodes.
301       So if there is a SCSI disk at /dev/sda then 'sdparm /dev/sda' will work
302       in both the lk 2.6 and lk 2.4 series. However  if  there  is  an  ATAPI
303       cd/dvd  drive  at /dev/hdc then 'sdparm /dev/hdc' will only work in the
304       lk 2.6 series.
305

PARAMETERS

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

ENUMERATE

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

TRANSPORTS

406       SCSI  transport protocols are a relatively specialized area that can be
407       safely ignored by the majority of users.
408
409       Some transport protocols have protocol specific mode pages.  These  are
410       usually  the  disconnect-reconnect (0x2), the protocol specific logical
411       unit (0x18) and the protocol specific port (0x19) mode pages.  In  some
412       cases the latter mode page has several subpages. The most common trans‐
413       port protocol abbreviations likely to be  used  are  "fcp",  "spi"  and
414       "sas".
415
416       Many  of  the field names are re-used in the same position so the acro‐
417       nym_name namespaces have been divided between generic mode pages  (i.e.
418       when  the  --transport= option is _not_ given) and a namespace for each
419       transport protocol. A LUPID field from the  protocol  specific  logical
420       unit  (0x18)  mode  page and the PPID field from protocol specific port
421       (0x19) mode page are included in the generic modes pages;  this  is  so
422       the  respective  (transport)  protocol identifiers can be seen. In most
423       cases the user will know what the "port" transport is  (i.e.  the  same
424       transport  as the HBA in the computer) but the logical unit's transport
425       could be different.
426

VENDORS

428       SCSI leaves a lot of space for vendor specific information. Often  this
429       is  described  in  product  manuals.  The --vendor=VN (or -M=VN) option
430       allows known vendor specific mode pages to be examined and/or  modified
431       by acronym.
432
433       In  this utility the syntax and semantics of vendor specific mode pages
434       is very similar to those of transport  protocol  specific  mode  pages.
435       Both  cannot  be  specified  together.  Vendor specific modes pages can
436       still be accessed numerically (as shown at the end of the EXAMPLES sec‐
437       tion).
438

COMMANDS

440       The  command  option sends a SCSI command to the DEVICE. If the command
441       fails then this is reflected in the non-zero exit  status.   To  obtain
442       more information about the error use the -v option.
443
444       The  'capacity'  command sends a READ CAPACITY command (valid for disks
445       and cd/dvd media). If successful  yields  "blocks:  "  [the  number  of
446       blocks],  "block_length:  "  [typically either 512 or 2048] and "capac‐
447       ity_mib: " [capacity in MibiBytes (1048576 byte units)].
448
449       The 'eject' command stops the medium and ejects  it  from  the  device.
450       Note  that  ejection  (by  command or button) may be prevented in which
451       case the 'unlock' command may be useful in  extreme  cases.   Typically
452       only  appropriate  for  cd/dvd  drives  and  disk drives with removable
453       media. Objects if sent to another peripheral device type (but objection
454       can be overridden with '-f' option).
455
456       The  'load'  command  loads the medium and and starts it (i.e. spins it
457       up).  See 'eject' command for supported device types.
458
459       The 'ready' command sends the "Test Unit Ready"  SCSI  command  to  the
460       DEVICE.  No  error  is  reported  if  the  device  will respond to data
461       requests (e.g. READ) in a reasonable timescale. For example, if a  disk
462       is  stopped then it will report "not ready". All devices should respond
463       to this command.
464
465       The 'sense' command sends a REQUEST SENSE command. It reports  a  hard‐
466       ware  threshold exceeded, warning or low power condition if flagged. If
467       a progress indication is present (e.g. during a format) then it will be
468       output  as  a  percentage.  Yields a process status of 0 if the command
469       succeeds and the sense key is 0; else yields 1. The --quiet option  can
470       be used to lessen output, and --hex to output sense data in hex.
471
472       The  'start'  command starts the medium (i.e. spins it up). Harmless if
473       medium has already been started.  See  'eject'  command  for  supported
474       device types.
475
476       The  'stop'  command stops the medium (i.e. spins it down). Harmless if
477       medium has already been stopped.  See  'eject'  command  for  supported
478       device types.
479
480       The 'sync' command sends a SYNCHRONIZE CACHE command. The device should
481       flush any data held in its (volatile) buffers to the media.
482
483       The 'unlock' command tells a device to allow medium  removal.  It  uses
484       the  SCSI  "prevent  allow medium removal" command. This is desperation
485       stuff, possibly overriding a prevention applied by the OS on a  mounted
486       file  system.   The  "eject" utility (from the "eject" package) is more
487       graceful and should be tried first. This command  is  only  appropriate
488       for devices with removable media.
489
490       For  loading and ejecting tapes the mt utility should be used (i.e. not
491       these commands). The 'ready' command is valid for tape devices.
492

EXAMPLES

494       To list the common (generic) mode parameters of a disk:
495
496          sdparm /dev/sda
497
498       To list the designators within the device identification VPD page of  a
499       disk:
500
501          sdparm --inquiry /dev/sda
502
503       To see all parameters for the caching mode page:
504
505          sdparm --page=ca /dev/sda
506
507       To see all parameters for the caching mode page with parameter descrip‐
508       tions to the right:
509
510          sdparm --page=ca --long /dev/sda
511
512       To get the WCE values (current changeable default and saved) in hex:
513
514          sdparm -g WCE -H /dev/sda
515       0x01 0x00 0x01 0x01
516
517       To get the WCE current value in hex:
518
519          sdparm -g WCE=1 -H /dev/sda
520       0x01
521
522       To set the "Writeback Cache Enable" bit in the current values page:
523
524          sdparm --set=WCE /dev/sda
525
526       To set the "Writeback Cache Enable" bit in the current and saved values
527       page:
528
529          sdparm --set=WCE --save /dev/sda
530
531       To set the "Writeback Cache Enable" and clear "Read Cache Disable":
532
533          sdparm --set=WCE --clear=RCD --save /dev/sda
534
535       The previous example can also by written as:
536
537          sdparm -s WCE=1,RCD=0 -S /dev/sda
538
539       To  re-establish  the  manufacturer's defaults in the current and saved
540       values of the caching mode page:
541
542          sdparm --page=ca --defaults --save /dev/sda
543
544       If an ATAPI cd/dvd drive is at /dev/hdc then its common (mode)  parame‐
545       ters could be listed in the lk 2.6 series with:
546
547          sdparm /dev/hdc
548
549       If  there is a DVD in the drive at /dev/hdc then it could be ejected in
550       the lk 2.6 series with:
551
552          sdparm --command=eject /dev/hdc
553
554       If the ejection is being prevented by software then that can  be  over‐
555       ridden with:
556
557          sdparm --command=unlock /dev/hdc
558
559       One  disk  vendor  has a "Performance Mode" bit (PM) in the vendor spe‐
560       cific unit attention mode page [0x0,0x0].  PM=0  is  server  mode  (the
561       default) while PM=1 is desktop mode. Desktop mode can be set (both cur‐
562       rent and saved values) with:
563
564          sdparm --page=0 --set=2:7:1=1 --save /dev/sda
565
566       The resultant change can be viewed in hex  with  the  --hex  option  as
567       there are no acronyms for vendor extensions yet. The PM bit is now cov‐
568       ered by vendor specific mode pages and the above  can  also  be  accom‐
569       plished with:
570
571          sdparm --vendor=sea --set=PM --save /dev/sda
572

EXIT STATUS

574       To  aid  scripts  that  call sdparm, the exit status is set to indicate
575       success (0) or failure (1 or more). Note that some of the lower  values
576       correspond to the SCSI sense key values. The exit status values are:
577
578       0      success
579
580       1      syntax  error. Either illegal command line options, options with
581              bad arguments or a combination of options that is not permitted.
582
583       2      the DEVICE reports that  it  is  not  ready  for  the  operation
584              requested.  The  device  may be in the process of becoming ready
585              (e.g.  spinning up but not at speed) so  the  utility  may  work
586              after a wait.
587
588       3      the  DEVICE  reports  a  medium  or  hardware  error (or a blank
589              check). For example an attempt to read a corrupted  block  on  a
590              disk will yield this value.
591
592       5      the DEVICE reports an "illegal request" with an additional sense
593              code other than "invalid operation code". This is often  a  sup‐
594              ported  command with a field set requesting an unsupported capa‐
595              bility. For commands that require a "service action" field  this
596              value can indicate that the command is not supported.
597
598       6      the  DEVICE  reports  a "unit attention" condition. This usually
599              indicates that something unrelated to the requested command  has
600              occurred  (e.g.  a  device reset) potentially before the current
601              SCSI command was sent. The requested command has not  been  exe‐
602              cuted  by  the  device.  Note that unit attention conditions are
603              usually only reported once by a device.
604
605       9      the DEVICE reports an illegal request with an  additional  sense
606              code  of  "invalid  operation  code" which means that it doesn't
607              support the requested command.
608
609       11     the DEVICE reports an aborted command.  In  some  cases  aborted
610              commands  can  be  retried  immediately  (e.g.  if the transport
611              aborted the command due to congestion).
612
613       15     the utility is unable to open, close or use  the  given  DEVICE.
614              The  given  file name could be incorrect or there may be permis‐
615              sion problems. Adding the -v option may give more information.
616
617       20     the DEVICE reports it has a  check  condition  but  "no  sense".
618              Some  polling  commands (e.g. REQUEST SENSE) can react this way.
619              It is unlikely that this value will occur as an exit status.
620
621       21     the DEVICE reports a "recovered error".  The  requested  command
622              was  successful.  Most  likely a utility will report a recovered
623              error to stderr and continue, probably leaving the utility  with
624              an exit status of 0 .
625
626       33     the  command  sent to DEVICE has timed out. This occurs in Linux
627              only; in other ports a command timeout will appear as  a  trans‐
628              port (or OS) error.
629
630       97     the response to a SCSI command failed sanity checks.
631
632       98     the  DEVICE  reports  it  has  a  check  condition but the error
633              doesn't fit into any of the above categories.
634
635       99     any errors that can't be categorized into values  1  to  98  may
636              yield  this  value. This includes transport and operating system
637              errors after the command has been sent to the device.
638
639       Most of the error conditions reported  above  will  be  repeatable  (an
640       example  of  one that is not is "unit attention") so the utility can be
641       run again with the -v option (or several) to obtain more information.
642

AUTHORS

644       Written by Douglas Gilbert.
645

REPORTING BUGS

647       Report bugs to <dgilbert at interlog dot com>.
648
650       Copyright © 2005-2007 Douglas Gilbert
651       This software is distributed under a FreeBSD license. There is NO  war‐
652       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
653       POSE.
654

SEE ALSO

656       hdparm(hdparm), sg_modes, sg_wr_mode,  sginfo,  sg_inq,  sg_vpd(all  in
657       sg3_utils),      smartmontools(smartmontools.sourceforge.net),      mt,
658       eject(eject),
659
660
661
662sdparm-1.02                      October 2007                        SDPARM(8)
Impressum