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  ig‐
50       nored).  The --inhex=FN form decodes mode or VPD response data provided
51       in the named file (or from stdin if FN=- is given); that data  may  ei‐
52       ther  be  in hexadecimal or binary. The second last form is for Windows
53       only and lists the available storage device names; see the OPTIONS  en‐
54       try  for --wscan. The final form is to provide command line help or the
55       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  de‐
70       tected, it is noted and the utility continues. Error value 5 (file open
71       or close problem) is treated as lower priority when  other  errors  are
72       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  De‐
90       vice  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 as‐
102       sumed 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  op‐
158              tion 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 op‐
163              tions  apart from the --all, --inquiry, --long, --page=PG[,SPG],
164              --transport=TN and --vendor=VN. If --enumerate is given  without
165              other  options  then  the known (generic) mode pages are listed.
166              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  se‐
180              quence  of VPD pages can be probed with --page=PG[,SPG] in which
181              case VPD pages from PG (lower number) to SPG (high  number)  in‐
182              clusive  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 at‐
192              tempted. This option will also allow mode pages that  don't  be‐
193              long 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  de‐
226              fault action is to output mode pages. If the --inquiry option is
227              given without the --page=PG[,SPG] option then the device identi‐
228              fication  VPD  page (0x83) is decoded and output. If this option
229              and the --all option are given then the supported VPD pages page
230              (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 bi‐
250              nary.
251
252       -l, --long
253              output extra information. In the case of mode page fields a  de‐
254              scription  (with units if applicable) is output to the right. If
255              used twice, then for some fields more information about its val‐
256              ues  is given on one or more following lines, each prefixed by a
257              tab character. For usage with --enumerate see the ENUMERATE sec‐
258              tion 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 de‐
265              scriptors for the given page on the DEVICE is output.  Otherwise
266              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 in‐
279              terpreted 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 is‐
289              sued and a list of possibilities in the current context is given
290              (so '-p x' can be quite useful). If the STR matches a known  VPD
291              page  abbreviation then the --inquiry option is assumed. For us‐
292              age with --enumerate see the ENUMERATE section below.
293
294       -P, --pdt=DT
295              This option is only active when the --inhex=FN option is  given.
296              DT  is  the peripheral Device Type, a value between 0 and 31 and
297              can be found in the response to the INQUIRY command. The default
298              value  is  -1  (which may also be given for DT) and it is inter‐
299              preted as SPC (i.e. common mode pages) or as  a  wild  card.  If
300              available this option should be supplied with the --inhex=FN op‐
301              tion.
302
303       -q, --quiet
304              suppress output of device name followed by the  vendor,  product
305              and  revision  strings fetched from an INQUIRY response. Without
306              this option such a line is typically the first  line  output  by
307              sdparm.  Reduces output from the device identification VPD page,
308              typically to one line (or none)  for  each  of  di_lu,  di_port,
309              di_target and di_asis.
310              If  this option is used twice then additionally mode page output
311              suppresses the changeable, default and  saved  values  that  are
312              usually shown in braces, if available.
313
314       -r, --readonly
315              override  other  logic to open DEVICE in read-only mode. The de‐
316              fault setting of the open read-only/read-write mode  depends  on
317              the  operation  requested (e.g. a --set=STR operation by default
318              will try a read-write mode open on DEVICE). This option  may  be
319              useful if a command is being sent to an ATA disk via a SCSI com‐
320              mand set. For example in Linux '-C stop' may require this option
321              to stop an ATA disk being restarted immediately.
322
323       -R, --raw
324              this option is only active when used with the --inhex=FN option.
325              When this option is given then the file FN is interpreted as bi‐
326              nary; the default action (i.e. when this option is not given) is
327              to interpret FN as ASCII hexadecimal.
328
329       -S, --save
330              when a mode page is being modified  (by  using  the  --clear=STR
331              and/or  --set=STR  options) then the default action is to modify
332              only the current values mode page. When  this  option  is  given
333              then the corresponding value(s) in the saved values mode page is
334              also changed. The next time the device is power cycled  (or  re‐
335              set)  the saved values mode page becomes (i.e. is copied to) the
336              current values mode page. This option sets the SP field  in  the
337              MODE SELECT command. See NOTES section below.
338
339       -s, --set=STR
340              in  its  simplest  form  STR  contains a field acronym_name or a
341              field numerical descriptor. In the absence of an explicit value,
342              each  acronym_name has its value set to (all) ones. This means a
343              16 bit field will be set to 0xffff which is  65535  in  decimal.
344              Alternatively  each  acronym_name or numerical descriptor may be
345              followed by "=<n>" where <n> is the value to set that field  to.
346              See the PARAMETERS section below.
347
348       -6, --six
349              The  default  action  of this utility is to issue MODE SENSE and
350              MODE SELECT SCSI commands with 10 byte cdbs. When this option is
351              given the 6 byte cdb variants are used. RBC and old SCSI devices
352              may need this option. This utility outputs a suggestion  to  use
353              this  option  if  the SCSI status indicates that the 10 byte cdb
354              variant is not supported.
355              The SPC-4 standard (and SPC-5 drafts)  include  a  note  stating
356              that  implementers migrate away from the SCSI MODE SELECT(6) and
357              MODE SENSE(6) commands in favour of the 10 byte  variants  (e.g.
358              MODE SEMSE(10)).
359
360       -t, --transport=TN
361              Specifies  the transport protocol where TN is either a number in
362              the range 0 to 15 (inclusive) or an abbreviation (e.g. "fcp" for
363              the Fibre Channel Protocol). Some transports accept multiple ab‐
364              breviations, for example srp (SCSI RDMA Protocol) and ib  (short
365              for  InfiniBand)  both are accepted for transport protocol 0x4 .
366              Also both upper and lower case are accepted so iscsi  and  iSCSI
367              are accepted for transport protocol 0x5 . One way to list avail‐
368              able transport protocols numbers and their associated  abbrevia‐
369              tions  is to give an invalid transport protocol name such as '-t
370              x'; another way is '-e -l'.  N.B. The --all option may still  be
371              needed to show all available fields.
372
373       -M, --vendor=VN
374              Specifies  the  vendor  (i.e. manufacturer) where VN is either a
375              number (0 or more) or an abbreviation (e.g.  "sea"  for  Seagate
376              disk  vendor  specific).   For tape drives "lto5" and "lto6" are
377              treated as vendors. One way to list the available vendor numbers
378              and  their associated abbreviations is to give an invalid vendor
379              number such as '-M x'; another way is '-e -l'.
380              This option only effects mode page decodes, not VPD  pages.  For
381              vendor specific VPD pages see the sg_vpd utility.
382
383       -v, --verbose
384              increase  the  level  of verbosity, (i.e. debug output). In some
385              cases more decoding is done (e.g. fields within a  standard  IN‐
386              QUIRY response).
387
388       -V, --version
389              print the version string and then exit.
390
391       -w, --wscan
392              this  option  is available in Windows only. It lists storage de‐
393              vice names and the corresponding  volumes,  if  any.  When  used
394              twice  it  adds  the "bus type" of the closest transport (e.g. a
395              SATA disk in a USB connected enclosure has bus type  Usb).  When
396              used  three  times  a SCSI adapter scan is added. When used four
397              times only a SCSI adapter scan is shown.  See examples below and
398              the "Win32 port" section in the README file.
399

NOTES

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

PARAMETERS

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

ENUMERATE

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

TRANSPORTS

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

VENDORS

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

COMMANDS

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

EXAMPLES

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

EXIT STATUS

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

AUTHORS

943       Written by Douglas Gilbert.
944

REPORTING BUGS

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

WEB SITE

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

SEE ALSO

959       hdparm(hdparm),  sg_modes,  sg_wr_mode,  sginfo,  sg_inq, sg_vpd(all in
960       sg3_utils),      smartmontools(smartmontools.sourceforge.net),      mt,
961       eject(eject),
962
963
964
965sdparm-1.12                       April 2021                         SDPARM(8)
Impressum