1SDPARM(8) SDPARM SDPARM(8)
2
3
4
6 sdparm - access SCSI modes pages; read VPD pages; send simple SCSI com‐
7 mands.
8
10 sdparm [--all] [--clear=STR] [--command=CMD] [--dbd] [--defaults]
11 [--dummy] [--flexible] [--get=STR] [--help] [--hex] [--inquiry]
12 [--long] [--num-desc] [--page=PG[,SPG]] [--quiet] [--save] [--set=STR]
13 [--six] [--transport=TN] [--vendor=VN] [--verbose] [--version] DEVICE
14 [DEVICE...]
15
16 sdparm --enumerate [--all] [--inquiry] [--long] [--page=PG[,SPG]]
17 [--transport=TN] [--vendor=VN]
18
19 sdparm --wscan [--verbose]
20
22 This utility fetches and potentially changes SCSI device (e.g. disk)
23 mode pages. Inquiry data including Vital Product Data (VPD) pages can
24 also be displayed. Commands associated with starting and stopping the
25 medium; loading and unloading the medium; and other housekeeping func‐
26 tion may also be issued by this utility.
27
28 Of the three invocations shown in the synopsis, the first is the most
29 general. The second variant that uses --enumerate is for dumping infor‐
30 mation held in sdparm's internal tables. The last variant is for Win‐
31 dows only and lists the available device names; see the OPTIONS entry
32 for --wscan.
33
34 If no options (other than DEVICE) are given then a selection of common
35 mode page fields for that device are listed. If the --long option is
36 also given then a description of the fields is placed on the right of
37 each line. If the --all option is given then all known mode page fields
38 for that device are listed. Individual fields can be displayed with the
39 --get=STR option (e.g. '--get=WCE' to fetch the state of the Writeback
40 Cache Enable field).
41
42 This utility completes with an exit status of 0 when successful. For
43 other values see the EXIT STATUS section below.
44
45 One or more DEVICE arguments can be given. The utility will essentially
46 apply the given options to each DEVICE in the list. If an error is
47 detected, it is noted and the utility continues. Error value 5 (file
48 open or close problem) is treated as lower priority when other errors
49 are detected. The exit status is the most recently detected error value
50 (excluding error value 5 if other errors have been detected). If all
51 actions succeed the exit status is zero.
52
53 By default this utility shows mode pages that are common to all trans‐
54 port protocols. These are termed as "generic" mode pages. If there is
55 no match on a generic mode page name or field then those pages specific
56 to the SAS transport are checked. Transport protocol specific mode
57 pages are selected with the --transport=TN option. See the TRANSPORT
58 section below. Vendor specific mode pages are selected with the --ven‐
59 dor=VN option. See the VENDORS section below.
60
61 Although originally for SCSI disks (or storage devices that appear to
62 the OS as SCSI disks) many of the mode pages are for other SCSI device
63 types. These include CD/DVD players that use the ATAPI (or any other)
64 transport, SCSI tapes drives and SCSI enclosures.
65
66 When the --inquiry option is given without a page number then the
67 Device Identification VPD page (page number 0x83) is requested and if
68 found it is decoded and output. If no page number is given and the
69 --all option is given then a list of VPD page names (but not their con‐
70 tents) supported by the DEVICE is output. When both the --inquiry and
71 --page=PG options are given then the VPD page can be specified as an
72 abbreviation (e.g. "sp" for the SCSI ports VPD page) or numerically
73 (e.g. "0x88"). If a VPD page is returned by the DEVICE but sdparm can‐
74 not decode it or the --hex option is given then it is output in hex.
75
77 Mandatory arguments to long options are mandatory for short options as
78 well. If an option takes a numeric argument then that argument is
79 assumed to be decimal unless otherwise indicated (e.g. with a leading
80 "0x" or a trailing "h"). The options are in alphabetical order, based
81 on the long option name.
82
83 -a, --all
84 output all recognized fields for the device type (e.g. disk) of
85 the DEVICE. Without this option (or the --page=PG[,SPG] option)
86 the default action is to output a relatively small number of
87 commonly used fields from different pages. When a specific
88 (mode) page number is given with the --page=PG[,SPG] option then
89 all the fields of that page are output (irrespective of the set‐
90 ting of this option). For this option's action when used with
91 the --enumerate option see the ENUMERATE section below.
92
93 -c, --clear=STR
94 In its simplest form STR contains a field acronym_name or a
95 field numerical descriptor. In the absence of an explicit value
96 argument (e.g. '--clear=WCE=1'), the field has its value cleared
97 to zero. See the PARAMETERS section below.
98
99 -C, --command=CMD
100 Perform given CMD. See section below on COMMANDS. To enumerate
101 supported commands use '-e -C x' (using any CMD name, valid or
102 otherwise).
103
104 -B, --dbd
105 disable block descriptors. This is a bit in MODE SENSE cdbs that
106 rarely needs to be set. One known case is a MODE SENSE 6 issued
107 to a Reduced Block Commands (RBC) device where the RBC standard
108 says it shall be set.
109
110 -D, --defaults
111 sets the given mode page to its default values. Requires the
112 --page=PG[,SPG] option to be given to specify the mode page. To
113 make the default mode page values also the saved mode page val‐
114 ues, use the --save option as well.
115
116 -d, --dummy
117 when set inhibits changes being placed in the DEVICE's mode
118 page. Instead the mode data that would have been sent to a MODE
119 SELECT command, is output in ASCII hex to the console. This
120 option is mainly for testing.
121
122 -e, --enumerate
123 lists out descriptive information about the pages and fields
124 known to this utility. Ignores the DEVICE argument and other
125 options apart from the --all, --inquiry, --long,
126 --page=PG[,SPG], --transport=TN and --vendor=VN. If --enumerate
127 is given without other options then the known (generic) mode
128 pages are listed. See the ENUMERATE section below.
129
130 -f, --flexible
131 Some devices, bridges and/or drivers attempt crude transforma‐
132 tions between mode sense 6 and 10 byte commands without cor‐
133 rectly rebuilding the response. This will cause the response to
134 be mis-interpreted (usually with an error saying the response is
135 malformed). With this option, the length of the response is
136 checked, and if it looks wrong, various corrections are
137 attempted. This option will also allow mode pages that don't
138 belong to the current device's peripheral type to be listed.
139
140 -g, --get=STR
141 In its simplest form STR contains a field acronym_name or a
142 field numerical descriptor. The field is fetched from mode page.
143 See the PARAMETERS section below. The --long and --hex options
144 effect the output format. Also if a value of "1" is given (e.g.
145 '--get=WCE=1') only the current value is output (i.e. not the
146 change mask, the default value and the saved value).
147
148 -h, --help
149 output the usage message then exit.
150
151 -H, --hex
152 rather than trying to decode mode (or VPD) pages, print them out
153 in hex. When used with the --get=STR option the corresponding
154 current, changeable, default and saved values are output in hex,
155 prefixed by "0x" and space separated. If a value of "1" is given
156 with the --get=STR option (e.g. '--get=WCE=1') then only the
157 current value is output in hex, prefixed by "0x". If a value of
158 "2" is given with the --get=STR option then only the current
159 value is output as a (signed) integer. This option can be used
160 multiple times (e.g. '-HH'). Useful with the ATA Information VPD
161 page which usually outputs its IDENTIFY (PACKET) DEVICE response
162 in 16 bit hex words; with '-HH' outputs that response in hex
163 bytes; with '-HHH' outputs the same response in a format suit‐
164 able for 'hdparm --Istdin' to decode.
165
166 -i, --inquiry
167 output INQUIRY VPD pages. In the absence of this option the
168 default action is to output mode pages. If the --inquiry option
169 is given without the --page=PG[,SPG] option then the device
170 identification VPD page (0x83) is decoded and output. If this
171 option and the --all option are given then the supported VPD
172 pages page (0x0) is decoded and output.
173
174 -l, --long
175 output extra information. In the case of mode page fields a
176 description (with units if applicable) is output to the right.
177 If used twice, then for some fields more information about its
178 values is given on one or more following lines, each prefixed by
179 a tab character. For usage with --enumerate see the ENUMERATE
180 section below.
181
182 -n, --num-desc
183 for a mode page that can have descriptors, the number of
184 descriptors for the given page on the DEVICE is output. Other‐
185 wise 0 is output.
186
187 -p, --page=PG[,SPG]
188 supply the page number (PG) and optionally the sub page number
189 (SPG) of the mode (or VPD) page to fetch. These numbers are
190 interpreted as decimal unless prefixed with "0x" or a trailing.
191 Sub page numbers are only valid for mode pages (not VPD pages).
192 Alternatively an abbreviation for a page can be given (see next
193 entry).
194
195 -p, --page=STR
196 a two or three letter abbreviation for a page can be given.
197 Known mode page abbreviations are checked first followed by
198 known VPD page abbreviations. For example '--page=ca' matches
199 the caching mode page. If no match is found then an error is
200 issued and a list of possibilities in the current context is
201 given (so '-p x' can be quite useful). If the STR matches a
202 known VPD page abbreviation then the --inquiry option is
203 assumed. For usage with --enumerate see the ENUMERATE section
204 below.
205
206 -q, --quiet
207 suppress output of device name followed by the vendor, product
208 and revision strings fetched from an INQUIRY response. Without
209 this option such a line is typically the first line output by
210 sdparm. Reduces output from the device identification VPD page,
211 typically to one line (or none) for each of di_lu, di_port,
212 di_target and di_asis.
213
214 -S, --save
215 when a mode page is being modified (by using the --clear=STR
216 and/or --set=STR options) then the default action is to modify
217 only the current values mode page. When this option is given
218 then the corresponding value(s) in the saved values mode page is
219 also changed. The next time the device is power cycled (or
220 reset) the saved values mode page becomes (i.e. is copied to)
221 the current values mode page. See NOTES section below.
222
223 -s, --set=STR
224 in its simplest form STR contains a field acronym_name or a
225 field numerical descriptor. In the absence of an explicit value,
226 each acronym_name has its value set to (all) ones. This means a
227 16 bit field will be set to 0xffff which is 65535 in decimal.
228 Alternatively each acronym_name or numerical descriptor may be
229 followed by "=<n>" where <n> is the value to set that field to.
230 See the PARAMETERS section below.
231
232 -6, --six
233 The default action of this utility is to issue MODE SENSE and
234 MODE SELECT SCSI commands with 10 byte cdbs. When this option is
235 given the 6 byte cdb variants are used. RBC and old SCSI devices
236 may need this option. This utility outputs a suggestion to use
237 this option if the SCSI status indicates that the 10 byte cdb
238 variant is not supported.
239
240 -t, --transport=TN
241 Specifies the transport protocol where TN is either a number in
242 the range 0 to 15 (inclusive) or an abbreviation (e.g. "fcp" for
243 the Fibre Channel Protocol). One way to list available transport
244 protocols numbers and their associated abbreviations is to give
245 an invalid transport protocol number such as '-t x'; another way
246 is '-e -l'.
247
248 -M, --vendor=VN
249 Specifies the vendor (i.e. manufacturer) where VN is either a
250 number (0 or more) or an abbreviation (e.g. "sea" for Seagate
251 disk vendor specific). One way to list available vendor numbers
252 and their associated abbreviations is to give an invalid vendor
253 number such as '-M x'; another way is '-e -l'.
254
255 -v, --verbose
256 increase the level of verbosity, (i.e. debug output). In some
257 cases more decoding is done (e.g. fields within a standard
258 INQUIRY response).
259
260 -V, --version
261 print the version string and then exit.
262
263 -w, --wscan
264 this option is available in Windows only. It lists storage
265 device names and the corresponding volumes, if any. When used
266 twice it adds the "bus type" of the closest transport (e.g. a
267 SATA disk in a USB connected enclosure has bus type Usb). When
268 used three times a SCSI adapter scan is added. When used four
269 times only a SCSI adapter scan is shown. See examples below and
270 the "Win32 port" section in the README file.
271
273 A mode page for which no abbreviation is known (e.g. a vendor specific
274 mode page) can be listed in hexadecimal by using the option combination
275 '--page=PG --hex'.
276
277 Numbers input to sdparm (e.g. in the command line arguments) are
278 assumed to be in decimal unless there is a hexadecimal indicator. A
279 hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C lan‐
280 guage convention) or a trailing 'h' or 'H' (i.e. the convention used at
281 www.t10.org ). In the case of --page= either a string or number is
282 expected, so hex numbers like 'ch' (12) should be prefixed by a zero
283 (e.g. '0ch').
284
285 The SPC-4 draft (rev 2) says that devices that implement no distinction
286 between current and saved pages can return an error (ILLEGAL REQUEST,
287 invalid field in cdb) if the SP bit (which corresponds to the --save
288 option) is _not_ set. In such cases the --save option needs to be
289 given.
290
291 If the --save option is given but the existing mode page indicates (via
292 its PS bit) that the page is not savable, then this utility generates
293 an error message. That message suggests to try again without the --save
294 option.
295
296 Since the device identification VPD page (acronym_name "di") poten‐
297 tially contains a lot of diverse designators, several associated
298 acronyms are available. They are "di_lu" for designators associated
299 with the addressed logical unit, "di_port" for designators associated
300 with the target port (which the command arrived via) and "di_target"
301 for designators associated with the target device. When "di" is used
302 designators are grouped by lu, then port and then target device. To
303 see all designators decoded in the order that they appear in the VPD
304 page use "di_asis".
305
306 In the linux kernel 2.6 series any device node that understands a SCSI
307 command set (e.g. SCSI disks and CD/DVD drives) may be specified. More
308 precisely the driver that "owns" the device node must support the SG_IO
309 ioctl. In the lk 2.4 series only SCSI generic (sg) device nodes support
310 the SG_IO ioctl. However in the lk 2.4 series other SCSI device nodes
311 are mapped within this utility to their corresponding sg device nodes.
312 So if there is a SCSI disk at /dev/sda then 'sdparm /dev/sda' will work
313 in both the lk 2.6 and lk 2.4 series. However if there is an ATAPI
314 cd/dvd drive at /dev/hdc then 'sdparm /dev/hdc' will only work in the
315 lk 2.6 series.
316
318 In their simplest form the --clear=, --get= and --set= options (or
319 their short forms) take an acronym_name such as "WCE". In the case of
320 '--get=WCE' the value of "Writeback Cache Enable" in the caching mode
321 page will be fetched. In the case of '--set=WCE' that bit will be set
322 (to one). In the case of '--clear=WCE' that bit will be cleared (to
323 zero). When an acronym_name is given then the mode page is imputed from
324 that acronym_name (e.g. WCE is in the caching mode page).
325
326 Instead of an acronym_name a field within a mode page can be described
327 numerically with a <start_byte>:<start_bit>:<num_bits> tuple. These are
328 the <start_byte> (origin 0) within the mode page, a <start_bit> (0 to 7
329 inclusive) and <num_bits> (1 to 64 inclusive). For example, the low
330 level representation of the RCD bit (the "Read Cache Disable bit in the
331 caching mode page) is "2:0:1". The <start_byte> can optionally be given
332 in hex (e.g. '--set=0x2:0:1' or '--set=2h:0:1'). With this form the
333 --page= option is required to establish which mode page is to be used.
334
335 Either form can optionally be followed by "=<val>". By default <val> is
336 decimal but can be given in hex in the normal fashion. Here are some
337 examples: '--set=2h:0:1=1h' and '-s MRIE=0x3'. When the acronym_name or
338 numeric form following --clear= is not given an explicit '=<val>' then
339 the value defaults to zero. When the acronym_name or numeric form fol‐
340 lowing --set= is not given an explicit '=<val>' then the value defaults
341 to "all ones" (i.e. as many as <num_bits> permits). For example
342 '--clear=WCE' and '--clear=WCE=0' have the same meaning: clear Write‐
343 back Cache Enable or, put more simply: turn off the writeback cache.
344
345 Multiple fields within the same mode page can be changed by giving a
346 comma separated list of acronym_names and/or the numerical form. For
347 example: '--set=TEST,MRIE=6'.
348
349 Some mode page have multiple descriptors. They typically have a fixed
350 header section at the start of the mode page that includes a field con‐
351 taining the number of descriptors that follow. Following the header is
352 a variable number of descriptors. An example is the SAS Phy Control and
353 Discover mode page. An acronym_name may include a trailing '.<num>'
354 where "<num>" is a descriptor number (origin 0). For example '-t sas -g
355 PHID.0' and '-t sas -g PHID' will yield the phy identifier of the first
356 descriptor of the above mode page; '-t sas -g PHID.1' will yield the
357 phy identifier of the second descriptor.
358
360 The --enumerate option essentially dumps out static information held by
361 this utility. A list of --enumerate variants and their actions follows.
362 For brevity subsequent examples of options are shown in their shorter
363 form.
364
365 --enumerate list generic mode page information
366 -e --all list generic mode page contents
367 (i.e. parameters)
368 -e --page=rw list contents of read write error
369 recovery mode page
370 -e --inquiry list VPD pages this utility can decode
371 -e --long list generic mode pages, transport
372 protocols, mode pages for each
373 supported transport protocol and
374 supported commands
375 -e -l --all additionally list the contents of
376 each mode page
377 -e --transport=fcp list mode pages for the fcp
378 transport protocol
379 -e -t fcp --all additionally list the contents of
380 each mode page
381 -e --vendor=sea list vendor specific mode pages for
382 "sea" (Seagate)
383 -e -M sea --all additionally list the contents of vendor
384 specific mode pages for "sea" (Seagate)
385 -e -p pcd -l list contents of SAS phy control and
386 discovery mode page plus (due to "-l")
387 some descfriptor format information
388
389 When known mode pages are listed (via the --enumerate option) each
390 line starts with a two or three letter abbreviation. This is followed
391 by the page number (in hex prefixed by "0x") optionally followed by a
392 comma and the subpage number. Finally the descriptive name of the mode
393 page (e.g. as found in SPC-4) is output.
394
395 When known parameters (fields) of a mode page are listed, each line
396 starts with an acronym (indented a few spaces). This will match (or be
397 an acronym for) the description for that field found in the (draft)
398 standards. Next are three numbers, separated by colons, surrounded by
399 brackets. These are the start byte (in hex, prefixed by "0x") of the
400 beginning of the field within the mode page; the starting bit (0
401 through 7 inclusive) and then the number of bits. The descriptive name
402 of the parameter (field) is then given. If appropriate the descriptive
403 name includes units (e.g. "(ms)" means the units are milliseconds).
404 Adding the '-ll' option will list information about possible field val‐
405 ues for selected mode page parameters.
406
407 Mode parameters for which the num_bits is greater than 1 can be viewed
408 as unsigned integers. Often 16 and 32 bit fields are set to 0xffff and
409 0xffffffff respectively (all ones) which usually has a special meaning
410 (see drafts). This utility outputs such values as "-1" to save space
411 (rather than their unsigned integer equivalents). "-1" can also be
412 given as the value to a mode page field acronym (e.g. '--set=INTT=-1'
413 sets the interval timer field in the Informational Exceptions control
414 mode page to 0xffffffff).
415
417 SCSI transport protocols are a relatively specialized area that can be
418 safely ignored by the majority of users.
419
420 Some transport protocols have protocol specific mode pages. These are
421 usually the disconnect-reconnect (0x2), the protocol specific logical
422 unit (0x18) and the protocol specific port (0x19) mode pages. In some
423 cases the latter mode page has several subpages. The most common trans‐
424 port protocol abbreviations likely to be used are "fcp", "spi" and
425 "sas".
426
427 Many of the field names are re-used in the same position so the acro‐
428 nym_name namespaces have been divided between generic mode pages (i.e.
429 when the --transport= option is _not_ given) and a namespace for each
430 transport protocol. A LUPID field from the protocol specific logical
431 unit (0x18) mode page and the PPID field from protocol specific port
432 (0x19) mode page are included in the generic modes pages; this is so
433 the respective (transport) protocol identifiers can be seen. In most
434 cases the user will know what the "port" transport is (i.e. the same
435 transport as the HBA in the computer) but the logical unit's transport
436 could be different.
437
439 SCSI leaves a lot of space for vendor specific information. Often this
440 is described in product manuals. The --vendor=VN (or -M=VN) option
441 allows known vendor specific mode pages to be examined and/or modified
442 by acronym.
443
444 In this utility the syntax and semantics of vendor specific mode pages
445 is very similar to those of transport protocol specific mode pages.
446 Both cannot be specified together. Vendor specific modes pages can
447 still be accessed numerically (as shown at the end of the EXAMPLES sec‐
448 tion).
449
451 The command option sends a SCSI command to the DEVICE. If the command
452 fails then this is reflected in the non-zero exit status. To obtain
453 more information about the error use the -v option.
454
455 capacity
456 sends a READ CAPACITY command (valid for disks and cd/dvd
457 media). If successful yields "blocks: " [the number of blocks],
458 "block_length: " [typically either 512 or 2048] and "capac‐
459 ity_mib: " [capacity in MibiBytes (1048576 byte units)].
460
461 eject stops the medium and ejects it from the device. Note that ejec‐
462 tion (by command or button) may be prevented in which case the
463 'unlock' command may be useful in extreme cases. Typically only
464 appropriate for cd/dvd drives and disk drives with removable
465 media. Objects if sent to another peripheral device type (but
466 objection can be overridden with '-f' option).
467
468 load loads the medium and and starts it (i.e. spins it up). See
469 'eject' command for supported device types.
470
471 profile
472 lists the various formats that a CD/DVD/HD-DVD/BD drive sup‐
473 ports. These are called "profiles" in the MMC standard. The pro‐
474 files are listed one per line. If media is in the drive then
475 the profile that matches the media (if any) has an "*" to the
476 right of the line.
477
478 ready sends the "Test Unit Ready" SCSI command to the DEVICE. No error
479 is reported if the device will respond to data requests (e.g.
480 READ) in a reasonable timescale. For example, if a disk is
481 stopped then it will report "not ready". All devices should
482 respond to this command.
483
484 sense sends a REQUEST SENSE command. It reports a hardware threshold
485 exceeded, warning or low power condition if flagged. If a
486 progress indication is present (e.g. during a format) then it
487 will be output as a percentage. Yields a process status of 0 if
488 the command succeeds and the sense key is 0; else yields 1. The
489 --quiet option can be used to lessen output, and --hex to output
490 sense data in hex.
491
492 speed=SPEED
493 permits the speed of a CD, DVD, HD_DVD or BD disc in a drive to
494 be set (or at least influenced). It has this format: --com‐
495 mand=speed=SPEED where SPEED is in kilobytes per second. In this
496 case a kilobyte is 1000 bytes. The "times one" speed for a CD is
497 176.4 kB/s, for a DVD is 1350 kB/s and for both HD-DVD and BD it
498 is 4500 kB/s. If SPEED is zero then the drive is set to the
499 speed that it considers gives optimal performance. This command
500 sends a SET STREAMING multi-media command (MMC) to the drive.
501 The EXACT bit is clear so the drive will round the given SPEED
502 as necessary. The command is designed to control read speed;
503 setting write speed should be left to "burning" programs.
504
505 start starts the medium (i.e. spins it up). Harmless if medium has
506 already been started. See 'eject' command for supported device
507 types.
508
509 stop stops the medium (i.e. spins it down). Harmless if medium has
510 already been stopped. See 'eject' command for supported device
511 types.
512
513 sync sends a SYNCHRONIZE CACHE command. The device should flush any
514 data held in its (volatile) buffers to the media.
515
516 unlock tells a device to allow medium removal. It uses the SCSI "pre‐
517 vent allow medium removal" command. This is desperation stuff,
518 possibly overriding a prevention applied by the OS on a mounted
519 file system. The "eject" utility (from the "eject" package) is
520 more graceful and should be tried first. This command is only
521 appropriate for devices with removable media.
522
523 For loading and ejecting tapes the mt utility should be used (i.e. not
524 these commands). The 'ready' command is valid for tape devices.
525
527 To list the common (generic) mode parameters of a disk:
528
529 sdparm /dev/sda
530
531 To list the designators within the device identification VPD page of a
532 disk:
533
534 sdparm --inquiry /dev/sda
535
536 To see all parameters for the caching mode page:
537
538 sdparm --page=ca /dev/sda
539
540 To see all parameters for the caching mode page with parameter descrip‐
541 tions to the right:
542
543 sdparm --page=ca --long /dev/sda
544
545 To get the WCE values (current changeable default and saved) in hex:
546
547 sdparm -g WCE -H /dev/sda
548 0x01 0x00 0x01 0x01
549
550 To get the WCE current value in hex:
551
552 sdparm -g WCE=1 -H /dev/sda
553 0x01
554
555 To set the "Writeback Cache Enable" bit in the current values page:
556
557 sdparm --set=WCE /dev/sda
558
559 To set the "Writeback Cache Enable" bit in the current and saved values
560 page:
561
562 sdparm --set=WCE --save /dev/sda
563
564 To set the "Writeback Cache Enable" and clear "Read Cache Disable":
565
566 sdparm --set=WCE --clear=RCD --save /dev/sda
567
568 The previous example can also by written as:
569
570 sdparm -s WCE=1,RCD=0 -S /dev/sda
571
572 To re-establish the manufacturer's defaults in the current and saved
573 values of the caching mode page:
574
575 sdparm --page=ca --defaults --save /dev/sda
576
577 If an ATAPI cd/dvd drive is at /dev/hdc then its common (mode) parame‐
578 ters could be listed in the lk 2.6 series with:
579
580 sdparm /dev/hdc
581
582 If there is a DVD in the drive at /dev/hdc then it could be ejected in
583 the lk 2.6 series with:
584
585 sdparm --command=eject /dev/hdc
586
587 If the ejection is being prevented by software then that can be over‐
588 ridden with:
589
590 sdparm --command=unlock /dev/hdc
591
592 One disk vendor has a "Performance Mode" bit (PM) in the vendor spe‐
593 cific unit attention mode page [0x0,0x0]. PM=0 is server mode (the
594 default) while PM=1 is desktop mode. Desktop mode can be set (both cur‐
595 rent and saved values) with:
596
597 sdparm --page=0 --set=2:7:1=1 --save /dev/sda
598
599 The resultant change can be viewed in hex with the --hex option as
600 there are no acronyms for vendor extensions yet. The PM bit is now cov‐
601 ered by vendor specific mode pages and the above can also be accom‐
602 plished with:
603
604 sdparm --vendor=sea --set=PM --save /dev/sda
605
606 What follows are some examples from Windows using the '--wscan' option.
607 The idea is to list the storage device names on the system that might
608 be invoked by other uses of sdparm.
609
610 # sdparm --wscan
611 PD0 [C] FUJITSU MHY2160BH 0000
612 PD1 [DF] WD 2500BEV External 1.05 WD-WXE90
613 CDROM0 [E] MATSHITA DVD/CDRW UJDA775 CB03
614
615 So 'sdparm -a CDROM0' and 'sdparm -a E' will show all the (known) mode
616 page fields for the Matshita DVD/CD drive. By using the '--wsacan'
617 option twice, the bus type (as seen by the OS) is added to the output:
618
619 # sdparm -ww
620 PD0 [C] <Ata > FUJITSU MHY2160BH 0000
621 PD1 [DF] <Usb > WD 2500BEV External 1.05 WD-WXE90
622 CDROM0 [E] <Atapi> MATSHITA DVD/CDRW UJDA775 CB03
623
624 And the pattern continues to add a SCSI adapter scan. This may be use‐
625 ful if there are specialized storage related devices (e.g. a SES device
626 in an enclosure) but does add much extra information in this case.
627
628 # sdparm -www
629 PD0 [C] <Ata > FUJITSU MHY2160BH 0000
630 PD1 [DF] <Usb > WD 2500BEV External 1.05 WD-WXE90
631 CDROM0 [E] <Atapi> MATSHITA DVD/CDRW UJDA775 CB03
632
633 SCSI0:0,0,0 claimed=1 pdt=0h FUJITSU MHY2160BH 0000
634 SCSI1:0,0,0 claimed=1 pdt=5h MATSHITA DVD/CDRW UJDA775 CB03
635
637 To aid scripts that call sdparm, the exit status is set to indicate
638 success (0) or failure (1 or more). Note that some of the lower values
639 correspond to the SCSI sense key values. The exit status values are:
640
641 0 success
642
643 1 syntax error. Either illegal command line options, options with
644 bad arguments or a combination of options that is not permitted.
645
646 2 the DEVICE reports that it is not ready for the operation
647 requested. The device may be in the process of becoming ready
648 (e.g. spinning up but not at speed) so the utility may work
649 after a wait.
650
651 3 the DEVICE reports a medium or hardware error (or a blank
652 check). For example an attempt to read a corrupted block on a
653 disk will yield this value.
654
655 5 the DEVICE reports an "illegal request" with an additional sense
656 code other than "invalid operation code". This is often a sup‐
657 ported command with a field set requesting an unsupported capa‐
658 bility. For commands that require a "service action" field this
659 value can indicate that the command is not supported.
660
661 6 the DEVICE reports a "unit attention" condition. This usually
662 indicates that something unrelated to the requested command has
663 occurred (e.g. a device reset) potentially before the current
664 SCSI command was sent. The requested command has not been exe‐
665 cuted by the device. Note that unit attention conditions are
666 usually only reported once by a device.
667
668 9 the DEVICE reports an illegal request with an additional sense
669 code of "invalid operation code" which means that it doesn't
670 support the requested command.
671
672 11 the DEVICE reports an aborted command. In some cases aborted
673 commands can be retried immediately (e.g. if the transport
674 aborted the command due to congestion).
675
676 15 the utility is unable to open, close or use the given DEVICE.
677 The given file name could be incorrect or there may be permis‐
678 sion problems. Adding the -v option may give more information.
679
680 20 the DEVICE reports it has a check condition but "no sense".
681 Some polling commands (e.g. REQUEST SENSE) can react this way.
682 It is unlikely that this value will occur as an exit status.
683
684 21 the DEVICE reports a "recovered error". The requested command
685 was successful. Most likely a utility will report a recovered
686 error to stderr and continue, probably leaving the utility with
687 an exit status of 0 .
688
689 33 the command sent to DEVICE has timed out. This occurs in Linux
690 only; in other ports a command timeout will appear as a trans‐
691 port (or OS) error.
692
693 97 the response to a SCSI command failed sanity checks.
694
695 98 the DEVICE reports it has a check condition but the error
696 doesn't fit into any of the above categories.
697
698 99 any errors that can't be categorized into values 1 to 98 may
699 yield this value. This includes transport and operating system
700 errors after the command has been sent to the device.
701
702 Most of the error conditions reported above will be repeatable (an
703 example of one that is not is "unit attention") so the utility can be
704 run again with the -v option (or several) to obtain more information.
705
707 Written by Douglas Gilbert.
708
710 Report bugs to <dgilbert at interlog dot com>.
711
713 Copyright © 2005-2009 Douglas Gilbert
714 This software is distributed under a FreeBSD license. There is NO war‐
715 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
716 POSE.
717
719 There is a web page discussing this package at
720 http://sg.danny.cz/sg/sdparm.html .
721
723 hdparm(hdparm), sg_modes, sg_wr_mode, sginfo, sg_inq, sg_vpd,
724 sg_scan(all in sg3_utils), smartmontools(smartmontools.source‐
725 forge.net), mt, eject(eject),
726
727
728
729sdparm-1.04 April 2009 SDPARM(8)