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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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

NOTES

402       The reference document used for interpreting mode and  VPD  pages  (and
403       the  INQUIRY  standard  response)  is  T10/BSR  INCITS  502 Revision 17
404       (SPC-5, 19 September 2017) found at http://www.t10.org .  Obsolete  and
405       reserved items in the standard INQUIRY response output are displayed in
406       brackets. Recent drafts of other T10 documents  are  also  used:  SBC-4
407       (disks),  SSC-5  (tapes),  SPL-5 (SAS transport) and SAT-4 (SCSI to ATA
408       Translation).
409
410       A mode page for which no abbreviation is known (e.g. a vendor  specific
411       mode page) can be listed in hexadecimal by using the option combination
412       '--page=PG --hex'.
413
414       Numbers input to sdparm  (e.g.  in  the  command  line  arguments)  are
415       assumed  to  be  in  decimal unless there is a hexadecimal indicator. A
416       hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C lan‐
417       guage convention) or a trailing 'h' or 'H' (i.e. the convention used at
418       www.t10.org ). In the case of --page= either  a  string  or  number  is
419       expected,  so  hex  numbers like 'ch' (12) should be prefixed by a zero
420       (e.g. '0ch').
421
422       The SPC-4 draft (rev 2) says that devices that implement no distinction
423       between  current  and saved pages can return an error (ILLEGAL REQUEST,
424       invalid field in cdb) if the SP bit (which corresponds  to  the  --save
425       option)  is  _not_  set.  In  such  cases the --save option needs to be
426       given.
427
428       If the --save option is given but the existing mode page indicates (via
429       its  PS bit) that the page is not saveable, then this utility generates
430       an error message. That message suggests to try again without the --save
431       option.
432
433       Since  the  device  identification  VPD page (acronym_name "di") poten‐
434       tially contains  a  lot  of  diverse  designators,  several  associated
435       acronyms  are  available.  They  are "di_lu" for designators associated
436       with the addressed logical unit, "di_port" for  designators  associated
437       with  the  target  port (which the command arrived via) and "di_target"
438       for designators associated with the target device. When  "di"  is  used
439       designators  are  grouped  by lu, then port and then target device.  To
440       see all designators decoded in the order that they appear  in  the  VPD
441       page use "di_asis".
442
443       Only  those  VPD  pages defined by t10.org are decoded by this utility.
444       SPC-4 sets aside VPD pages codes from 0xc0 to 0xff (inclusive) for ven‐
445       dor specific pages some of which are decoded in the sg_vpd utility.
446
447       To see all VPD pages supported by a DEVICE use 'sg_vpd --all'.
448
449       In the linux kernel 2.6 and 3 series any device node that understands a
450       SCSI command set (e.g. SCSI disks and CD/DVD drives) may be  specified.
451       More  precisely the driver that "owns" the device node must support the
452       SG_IO ioctl. In the lk 2.4 series only SCSI generic (sg)  device  nodes
453       support the SG_IO ioctl. However in the lk 2.4 series other SCSI device
454       nodes are mapped within this utility to their corresponding  sg  device
455       nodes.  So  if  there is a SCSI disk at /dev/sda then 'sdparm /dev/sda'
456       will work in both the lk 2.4 series and later. However if there  is  an
457       ATAPI cd/dvd drive at /dev/hdc then 'sdparm /dev/hdc' will only work in
458       the lk 2.6 series and later.
459
460       In the Linux 2.6 and 3 series, especially with ATA disks, using  sdparm
461       to  stop  (spin down) a disk may not be sufficient and other mechanisms
462       will start the disk again some time later. The user might  additionally
463       mark    the    disk    as    "offline"    with    'echo    offline    >
464       /sys/block/sda/device/state' where sda is the block name of  the  disk.
465       To restart the disk "offline" can be replaced with "running".
466

PARAMETERS

468       In  their  simplest  form  the  --clear=, --get= and --set= options (or
469       their short forms) take an acronym_name such as "WCE". In the  case  of
470       '--get=WCE'  the  value of "Writeback Cache Enable" in the caching mode
471       page will be fetched. In the case of '--set=WCE' that bit will  be  set
472       (to  one).  In  the  case of '--clear=WCE' that bit will be cleared (to
473       zero). When an acronym_name is given then the mode page is imputed from
474       that acronym_name (e.g. WCE is in the caching mode page).
475
476       Instead  of an acronym_name a field within a mode page can be described
477       numerically with a <start_byte>:<start_bit>:<num_bits> tuple. These are
478       the <start_byte> (origin 0) within the mode page, a <start_bit> (0 to 7
479       inclusive) and <num_bits> (1 to 64 inclusive).  For  example,  the  low
480       level representation of the RCD bit (the "Read Cache Disable bit in the
481       caching mode page) is "2:0:1". The <start_byte> can optionally be given
482       in  hex  (e.g.  '--set=0x2:0:1'  or '--set=2h:0:1'). With this form the
483       --page= option is required to establish which mode page is to be used.
484
485       Either form can optionally be followed by "=<val>". By default <val> is
486       decimal  but  can  be given in hex in the normal fashion. Here are some
487       examples: '--set=2h:0:1=1h' and '-s MRIE=0x3'. When the acronym_name or
488       numeric  form following --clear= is not given an explicit '=<val>' then
489       the value defaults to zero. When the acronym_name or numeric form  fol‐
490       lowing --set= is not given an explicit '=<val>' then the value defaults
491       to "all ones"  (i.e.  as  many  as  <num_bits>  permits).  For  example
492       '--clear=WCE'  and  '--clear=WCE=0' have the same meaning: clear Write‐
493       back Cache Enable or, put more simply: turn off the writeback cache.
494
495       Multiple fields within the same mode page can be changed  by  giving  a
496       comma  separated  list  of acronym_names and/or the numerical form. For
497       example: '--set=TEST,MRIE=6'.
498
499       Some mode page have multiple descriptors. They typically have  a  fixed
500       header section at the start of the mode page that includes a field con‐
501       taining the number of descriptors that follow. Following the header  is
502       a variable number of descriptors. An example is the SAS Phy Control and
503       Discover mode page. An acronym_name may  include  a  trailing  '.<num>'
504       where "<num>" is a descriptor number (origin 0). For example '-t sas -g
505       PHID.0' and '-t sas -g PHID' will yield the phy identifier of the first
506       descriptor  of  the  above mode page; '-t sas -g PHID.1' will yield the
507       phy identifier of the second descriptor.
508

ENUMERATE

510       The --enumerate option essentially dumps out static information held by
511       this utility. A list of --enumerate variants and their actions follows.
512       For brevity subsequent examples of options are shown in  their  shorter
513       form.
514
515           --enumerate          list generic mode page information
516           -e --all             list generic mode page contents
517                                (i.e. parameters)
518           -e --page=rw         list contents of read write error
519                                recovery mode page
520           -e --inquiry         list VPD pages this utility can decode
521           -e --long            list generic mode pages, transport
522                                protocols, mode pages for each
523                                supported transport protocol and
524                                supported commands
525           -e -l --all          additionally list the contents of
526                                each mode page
527           -e --transport=fcp   list mode pages for the fcp
528                                transport protocol
529           -e -t fcp --all      additionally list the contents of
530                                each mode page
531           -e --vendor=sea      list vendor specific mode pages for
532                                "sea" (Seagate)
533           -e -M sea --all      additionally list the contents of vendor
534                                specific mode pages for "sea" (Seagate)
535           -e -p pcd -l         list contents of SAS phy control and
536                                discovery mode page plus (due to "-l")
537                                some descfriptor format information
538
539       When  known  mode  pages  are listed (via the --enumerate  option) each
540       line starts with a two or three letter abbreviation. This  is  followed
541       by  the  page number (in hex prefixed by "0x") optionally followed by a
542       comma and the subpage number. Finally the descriptive name of the  mode
543       page (e.g. as found in SPC-4) is output.
544
545       When  known  parameters  (fields)  of a mode page are listed, each line
546       starts with an acronym (indented a few spaces). This will match (or  be
547       an  acronym  for)  the  description for that field found in the (draft)
548       standards. Next are three numbers, separated by colons,  surrounded  by
549       brackets.  These  are  the start byte (in hex, prefixed by "0x") of the
550       beginning of the field within  the  mode  page;  the  starting  bit  (0
551       through  7 inclusive) and then the number of bits. The descriptive name
552       of the parameter (field) is then given. If appropriate the  descriptive
553       name  includes  units  (e.g.  "(ms)" means the units are milliseconds).
554       Adding the '-ll' option will list information about possible field val‐
555       ues for selected mode page parameters.
556
557       Mode  parameters for which the num_bits is greater than 1 can be viewed
558       as unsigned integers. Often 16 and 32 bit fields are set to 0xffff  and
559       0xffffffff  respectively (all ones) which usually has a special meaning
560       (see drafts). This utility outputs such values as "-1"  to  save  space
561       (rather  than  their  unsigned  integer  equivalents). "-1" can also be
562       given as the value to a mode page field acronym  (e.g.  '--set=INTT=-1'
563       sets  the  interval timer field in the Informational Exceptions control
564       mode page to 0xffffffff).
565

TRANSPORTS

567       SCSI transport protocols are a relatively specialized area that can  be
568       safely ignored by the majority of users.
569
570       Some  transport  protocols have protocol specific mode pages. These are
571       usually the disconnect-reconnect (0x2), the protocol  specific  logical
572       unit  (0x18)  and the protocol specific port (0x19) mode pages. In some
573       cases the latter mode page has several subpages. The most common trans‐
574       port  protocol  abbreviations  likely  to  be used are "fcp", "spi" and
575       "sas".
576
577       Many of the field names are re-used in the same position so  the  acro‐
578       nym_name  namespaces have been divided between generic mode pages (i.e.
579       when the --transport= option is _not_ given) and a namespace  for  each
580       transport  protocol.  A  LUPID field from the protocol specific logical
581       unit (0x18) mode page and the PPID field from  protocol  specific  port
582       (0x19)  mode  page  are included in the generic modes pages; this is so
583       the respective (transport) protocol identifiers can be  seen.  In  most
584       cases  the  user  will know what the "port" transport is (i.e. the same
585       transport as the HBA in the computer) but the logical unit's  transport
586       could be different.
587

VENDORS

589       SCSI  leaves a lot of space for vendor specific information. Often this
590       is described in product manuals.  The  --vendor=VN  (or  -M=VN)  option
591       allows  known vendor specific mode pages to be examined and/or modified
592       by acronym.
593
594       In this utility the syntax and semantics of vendor specific mode  pages
595       is  very  similar  to  those of transport protocol specific mode pages.
596       Both cannot be specified together.  Vendor  specific  modes  pages  can
597       still be accessed numerically (as shown at the end of the EXAMPLES sec‐
598       tion).
599

COMMANDS

601       The command option sends a SCSI command to the DEVICE. If  the  command
602       fails  then  this  is reflected in the non-zero exit status.  To obtain
603       more information about the error use the -v option.
604
605       capacity
606              sends a READ CAPACITY(10) command (valid for  disks  and  cd/dvd
607              media)  by  default. If successful yields "blocks: " [the number
608              of blocks], "block_length: " [typically either 512 or 2048]  and
609              "capacity_mib: " [capacity in MibiBytes (1048576 byte units)].
610
611       If  the  number  of blocks is too large to fit in the 4 byte field pro‐
612       vided by READ CAPACITY(10) or, the --long option  is  given,  then  the
613       READ  CAPACITY(16) command is sent. If the --long option is given, then
614       the extra fields found in the READ CAPACITY(16) response are output.
615
616       eject  stops the medium and ejects it from the device.  Note that ejec‐
617              tion  (by  command or button) may be prevented in which case the
618              'unlock' command may be useful in extreme cases.  Typically only
619              appropriate  for  cd/dvd  drives  and disk drives with removable
620              media. Objects if sent to another peripheral  device  type  (but
621              objection can be overridden with '-f' option).
622
623       load   loads  the  medium and starts it (i.e. spins it up). See 'eject'
624              command for supported device types.
625
626       profile
627              lists the various formats that  a  CD/DVD/HD-DVD/BD  drive  sup‐
628              ports. These are called "profiles" in the MMC standard. The pro‐
629              files are listed one per line.  If media is in  the  drive  then
630              the  profile  that  matches the media (if any) has an "*" to the
631              right of the line.
632
633       ready  sends the "Test Unit Ready" SCSI command to the DEVICE. No error
634              is  reported  if  the device will respond to data requests (e.g.
635              READ) in a reasonable timescale.  For  example,  if  a  disk  is
636              stopped  then  it  will  report  "not ready". All devices should
637              respond to this command.
638
639       sense  sends a REQUEST SENSE command. It reports a  hardware  threshold
640              exceeded,  warning  or  low  power  condition  if  flagged. If a
641              progress indication is present (e.g. during a  format)  then  it
642              will  be output as a percentage. Yields a process status of 0 if
643              the command succeeds and the sense key is 0; else yields 1.  The
644              --quiet option can be used to lessen output, and --hex to output
645              sense data in hex.
646
647       speed=SPEED
648              permits the speed of a CD, DVD, HD_DVD or BD disc in a drive  to
649              be  set  (or  at  least  influenced). It has this format: --com‐
650              mand=speed=SPEED where SPEED is in kilobytes per second. In this
651              case a kilobyte is 1000 bytes. The "times one" speed for a CD is
652              176.4 kB/s, for a DVD is 1350 kB/s and for both HD-DVD and BD it
653              is  4500  kB/s.  If  SPEED  is zero then the drive is set to the
654              speed that it considers gives optimal performance.  This command
655              sends  a  SET  STREAMING multi-media command (MMC) to the drive.
656              The EXACT bit is clear so the drive will round the  given  SPEED
657              as  necessary.   The  command is designed to control read speed;
658              setting write speed should be left to "burning" programs.
659
660       start  starts the medium (i.e. spins it up).  Harmless  if  medium  has
661              already  been  started. See 'eject' command for supported device
662              types. If the DEVICE is an ATA disk in  Linux  the  '--readonly'
663              option may be required.
664
665       stop   stops  the  medium  (i.e. spins it down). Harmless if medium has
666              already been stopped. See 'eject' command for  supported  device
667              types.  If  the  DEVICE is an ATA disk in Linux the '--readonly'
668              option may be required. See the NOTES section above.
669
670       sync   sends a SYNCHRONIZE CACHE command. The device should  flush  any
671              data held in its (volatile) buffers to the media.
672
673       unlock tells  a  device to allow medium removal. It uses the SCSI "pre‐
674              vent allow medium removal" command. This is  desperation  stuff,
675              possibly  overriding a prevention applied by the OS on a mounted
676              file system. The "eject" utility (from the "eject"  package)  is
677              more  graceful  and  should be tried first. This command is only
678              appropriate for devices with removable media.
679
680       For loading and ejecting tapes the mt utility should be used (i.e.  not
681       these commands). The 'ready' command is valid for tape devices.
682

EXAMPLES

684       To list the common (generic) mode parameters of a disk:
685
686          sdparm /dev/sda
687
688       To  list the designators within the device identification VPD page of a
689       disk:
690
691          sdparm --inquiry /dev/sda
692
693       To see all parameters for the caching mode page:
694
695          sdparm --page=ca /dev/sda
696
697       To see all parameters for the caching mode page with parameter descrip‐
698       tions to the right:
699
700          sdparm --page=ca --long /dev/sda
701
702       To get the WCE values (current changeable default and saved) in hex:
703
704          sdparm -g WCE -H /dev/sda
705       0x01 0x00 0x01 0x01
706
707       To get the WCE current value in hex:
708
709          sdparm -g WCE=1 -H /dev/sda
710       0x01
711
712       To set the "Writeback Cache Enable" bit in the current values page:
713
714          sdparm --set=WCE /dev/sda
715
716       To set the "Writeback Cache Enable" bit in the current and saved values
717       page:
718
719          sdparm --set=WCE --save /dev/sda
720
721       To set the "Writeback Cache Enable" and clear "Read Cache Disable":
722
723          sdparm --set=WCE --clear=RCD --save /dev/sda
724
725       The previous example can also by written as:
726
727          sdparm -s WCE=1,RCD=0 -S /dev/sda
728
729       To re-establish the manufacturer's defaults in the  current  and  saved
730       values of the caching mode page:
731
732          sdparm --page=ca --defaults --save /dev/sda
733
734       If  an ATAPI cd/dvd drive is at /dev/hdc then its common (mode) parame‐
735       ters could be listed in the lk 2.6 and 3 series with:
736
737          sdparm /dev/hdc
738
739       If there is a DVD in the drive at /dev/hdc then it could be ejected  in
740       the lk 2.6 and 3 series with:
741
742          sdparm --command=eject /dev/hdc
743
744       If  the  ejection is being prevented by software then that can be over‐
745       ridden with:
746
747          sdparm --command=unlock /dev/hdc
748
749       One disk vendor has a "Performance Mode" bit (PM) in  the  vendor  spe‐
750       cific  unit  attention  mode  page  [0x0,0x0]. PM=0 is server mode (the
751       default) while PM=1 is desktop mode. Desktop mode can be set (both cur‐
752       rent and saved values) with:
753
754          sdparm --page=0 --set=2:7:1=1 --save /dev/sda
755
756       The  resultant  change  can  be  viewed in hex with the --hex option as
757       there are no acronyms for vendor extensions yet. The PM bit is now cov‐
758       ered  by  vendor  specific  mode pages and the above can also be accom‐
759       plished with:
760
761          sdparm --vendor=sea --set=PM --save /dev/sda
762
763       What follows are some examples from Windows using the '--wscan' option.
764       The  idea  is to list the storage device names on the system that might
765       be invoked by other uses of sdparm.
766
767         # sdparm --wscan
768       PD0     [C]     FUJITSU   MHY2160BH         0000
769       PD1     [DF]    WD        2500BEV External  1.05  WD-WXE90
770       CDROM0  [E]     MATSHITA DVD/CDRW UJDA775  CB03
771
772       So 'sdparm -a CDROM0' and 'sdparm -a E' will show all the (known)  mode
773       page  fields  for  the  Matshita  DVD/CD  drive. By using the '--wscan'
774       option twice, the bus type (as seen by the OS) is added to the output:
775
776         # sdparm -ww
777       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
778       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
779       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
780
781       And the pattern continues to add a SCSI adapter scan. This may be  use‐
782       ful if there are specialized storage related devices (e.g. a SES device
783       in an enclosure) but does add much extra information in this case.
784
785         # sdparm -www
786       PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
787       PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
788       CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03
789
790       SCSI0:0,0,0   claimed=1 pdt=0h  FUJITSU   MHY2160BH         0000
791       SCSI1:0,0,0   claimed=1 pdt=5h  MATSHITA  DVD/CDRW UJDA775  CB03
792

EXIT STATUS

794       To aid scripts that call sdparm, the exit status  is  set  to  indicate
795       success  (0) or failure (1 or more). Note that some of the lower values
796       correspond to the SCSI sense key values. The exit status values are:
797
798       0      success
799
800       1      syntax error. Either illegal command line options, options  with
801              bad arguments or a combination of options that is not permitted.
802
803       2      the  DEVICE  reports  that  it  is  not  ready for the operation
804              requested. The device may be in the process  of  becoming  ready
805              (e.g.   spinning  up  but  not at speed) so the utility may work
806              after a wait.
807
808       3      the DEVICE reports a  medium  or  hardware  error  (or  a  blank
809              check).  For  example  an attempt to read a corrupted block on a
810              disk will yield this value.
811
812       5      the DEVICE reports an "illegal request" with an additional sense
813              code  other  than "invalid operation code". This is often a sup‐
814              ported command with a field set requesting an unsupported  capa‐
815              bility.  For commands that require a "service action" field this
816              value can indicate that the command is not supported.
817
818       6      the DEVICE reports a "unit attention"  condition.  This  usually
819              indicates  that something unrelated to the requested command has
820              occurred (e.g. a device reset) potentially  before  the  current
821              SCSI  command  was sent. The requested command has not been exe‐
822              cuted by the device. Note that  unit  attention  conditions  are
823              usually only reported once by a device.
824
825       7      the DEVICE reports a "data protect" sense key. This implies some
826              mechanism has blocked writes (or  possibly  all  access  to  the
827              media).
828
829       9      the  DEVICE  reports an illegal request with an additional sense
830              code of "invalid operation code" which  means  that  it  doesn't
831              support the requested command.
832
833       10     the  DEVICE  reports a "copy aborted". This implies another com‐
834              mand or  device  problem  has  stopped  a  copy  operation.  The
835              EXTENDED  COPY  family of commands (including WRITE USING TOKEN)
836              may return this sense key.
837
838       11     the DEVICE reports an aborted command.  In  some  cases  aborted
839              commands  can  be  retried  immediately  (e.g.  if the transport
840              aborted the command due to congestion).
841
842       14     the DEVICE reports a miscompare sense key.  VERIFY  and  COMPARE
843              AND WRITE commands may report this.
844
845       15     the  utility  is  unable to open, close or use the given DEVICE.
846              The given file name could be incorrect or there may  be  permis‐
847              sion problems. Adding the -v option may give more information.
848
849       20     the  DEVICE  reports  it  has  a check condition but "no sense".
850              Some polling commands (e.g. REQUEST SENSE) can react  this  way.
851              It is unlikely that this value will occur as an exit status.
852
853       21     the  DEVICE  reports  a "recovered error". The requested command
854              was successful. Most likely a utility will  report  a  recovered
855              error  to stderr and continue, probably leaving the utility with
856              an exit status of 0 .
857
858       22     the DEVICE reports that the current command  or  its  parameters
859              imply a logical block address (LBA) that is out of range.
860
861       24     the DEVICE reports a SCSI status of "reservation conflict". This
862              means access to the DEVICE with the  current  command  has  been
863              blocked  because another machine (HBA or SCSI "initiator") holds
864              a reservation on this DEVICE. On modern  SCSI  systems  this  is
865              related  to the use of the PERSISTENT RESERVATION family of com‐
866              mands.
867
868       25     the DEVICE reports a SCSI status of "condition  met".  Currently
869              only the PRE-FETCH command (see SBC-4) yields this status.
870
871       26     the  DEVICE  reports a SCSI status of "busy". SAM-5 defines this
872              status as the logical unit is temporarily unable  to  process  a
873              command.  It is recommended to re-issue the command.
874
875       27     the DEVICE reports a SCSI status of "task set full".
876
877       28     the  DEVICE  reports a SCSI status of "ACA active". ACA is "auto
878              contingent allegiance" and is seldom used.
879
880       29     the DEVICE reports a SCSI status of "task aborted". SAM-5  says:
881              "This status shall be returned if a command is aborted by a com‐
882              mand or task management function on another I_T  nexus  and  the
883              Control mode page TAS bit is set to one".
884
885       33     the  command  sent to DEVICE has timed out. This occurs in Linux
886              only; in other ports a command timeout will appear as  a  trans‐
887              port (or OS) error.
888
889       40     the  command  sent  to  DEVICE has received an "aborted command"
890              sense key with an additional sense code of 0x10. This  group  is
891              related to problems with protection information (PI or DIF). For
892              example this error may occur when reading a  block  on  a  drive
893              that  has  never been written (or is unmapped) if that drive was
894              formatted with type 1, 2 or 3 protection.
895
896       48     this is an internal message indicating a NVMe status field  (SF)
897              is other than zero after a command has been executed (i.e. some‐
898              thing went wrong).  Work in this area is currently experimental.
899
900       49     low level driver reports a response's residual count (i.e.  num‐
901              ber  of  bytes  actually  received  by HBA is 'requested_bytes -
902              residual_count') that is too high. So no useful  processing  can
903              be done with that response.
904
905       50 + <os_error_number>
906              OS system calls that fail often return a small integer number to
907              help indicate what the error is. For example in Unix the inabil‐
908              ity  of  a  system  call to allocate memory returns (in 'errno')
909              ENOMEM which often is associated with  the  integer  12.  So  62
910              (i.e. '50 + 12') may be returned by a utility in this case.
911
912       97     the response to a SCSI command failed sanity checks.
913
914       98     the  DEVICE  reports  it  has  a  check  condition but the error
915              doesn't fit into any of the above categories.
916
917       99     any errors that can't be categorized into values  1  to  98  may
918              yield  this  value. This includes transport and operating system
919              errors after the command has been sent to the device.
920
921       126    the utility was found but could  not  be  executed.  That  might
922              occur if the executable does not have execute permissions.
923
924       127    This  is the exit status for utility not found. That might occur
925              when a script calls a utility in this package but the PATH envi‐
926              ronment  variable  has  not  been properly set up, so the script
927              cannot find the executable.
928
929       128 + <signum>
930              If a signal kills a utility then the exit status is 128 plus the
931              signal number. For example if a segmentation fault occurs then a
932              utility is typically killed by SIGSEGV which according to 'man 7
933              signal'  has an associated signal number of 11; so the exit sta‐
934              tus will be 139 .
935
936       255    the utility tried to yield an exit status of 255 or larger. That
937              should not happen; given here for completeness.
938
939       Most  of  the  error  conditions  reported above will be repeatable (an
940       example of one that is not is "unit attention") so the utility  can  be
941       run again with the -v option (or several) to obtain more information.
942

AUTHORS

944       Written by Douglas Gilbert.
945

REPORTING BUGS

947       Report bugs to <dgilbert at interlog dot com>.
948
950       Copyright © 2005-2020 Douglas Gilbert
951       This  software is distributed under a FreeBSD license. There is NO war‐
952       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
953       POSE.
954

WEB SITE

956       There     is    a    web    page    discussing    this    package    at
957       http://sg.danny.cz/sg/sdparm.html .
958

SEE ALSO

960       hdparm(hdparm), sg_modes, sg_wr_mode,  sginfo,  sg_inq,  sg_vpd(all  in
961       sg3_utils),      smartmontools(smartmontools.sourceforge.net),      mt,
962       eject(eject),
963
964
965
966sdparm-1.11                       March 2020                         SDPARM(8)
Impressum