1HDPARM(8) System Manager's Manual HDPARM(8)
2
3
4
6 hdparm - get/set SATA/IDE device parameters
7
9 hdparm [options] [device ...]
10
12 hdparm provides a command line interface to various kernel interfaces
13 supported by the Linux SATA/PATA/SAS "libata" subsystem and the older
14 IDE driver subsystem. Many newer (2008 and later) USB drive enclosures
15 now also support "SAT" (SCSI-ATA Command Translation) and therefore may
16 also work with hdparm. E.g. recent WD "Passport" models and recent
17 NexStar-3 enclosures. Some options may work correctly only with the
18 latest kernels.
19
21 When no options are given, -acdgkmur is assumed. For "Get/set" op‐
22 tions, a query without the optional parameter (e.g. -d) will query
23 (get) the device state, and with a parameter (e.g., -d0) will set the
24 device state.
25
26 -a Get/set sector count for filesystem (software) read-ahead. This
27 is used to improve performance in sequential reads of large
28 files, by prefetching additional blocks in anticipation of them
29 being needed by the running task. Many IDE drives also have a
30 separate built-in read-ahead function, which augments this
31 filesystem (software) read-ahead function.
32
33 -A Get/set the IDE drive´s read-lookahead feature (usually ON by
34 default). Usage: -A0 (disable) or -A1 (enable).
35
36 -b Get/set bus state.
37
38 -B Get/set Advanced Power Management feature, if the drive supports
39 it. A low value means aggressive power management and a high
40 value means better performance. Possible settings range from
41 values 1 through 127 (which permit spin-down), and values 128
42 through 254 (which do not permit spin-down). The highest degree
43 of power management is attained with a setting of 1, and the
44 highest I/O performance with a setting of 254. A value of 255
45 tells hdparm to disable Advanced Power Management altogether on
46 the drive (not all drives support disabling it, but most do).
47
48 -c Get/set (E)IDE 32-bit I/O support. A numeric parameter can be
49 used to enable/disable 32-bit I/O support. Currently supported
50 values include 0 to disable 32-bit I/O support, 1 to enable
51 32-bit data transfers, and 3 to enable 32-bit data transfers
52 with a special sync sequence required by many chipsets. The
53 value 3 works with nearly all 32-bit IDE chipsets, but incurs
54 slightly more overhead. Note that "32-bit" refers to data
55 transfers across a PCI or VLB bus to the interface card only;
56 all (E)IDE drives still have only a 16-bit connection over the
57 ribbon cable from the interface card.
58
59 -C Check the current IDE power mode status, which will always be
60 one of unknown (drive does not support this command), ac‐
61 tive/idle (normal operation), standby (low power mode, drive has
62 spun down), or sleeping (lowest power mode, drive is completely
63 shut down). The -S, -y, -Y, and -Z options can be used to ma‐
64 nipulate the IDE power modes.
65
66 -d Get/set the "using_dma" flag for this drive. This option now
67 works with most combinations of drives and PCI interfaces which
68 support DMA and which are known to the kernel IDE driver. It is
69 also a good idea to use the appropriate -X option in combination
70 with -d1 to ensure that the drive itself is programmed for the
71 correct DMA mode, although most BIOSs should do this for you at
72 boot time. Using DMA nearly always gives the best performance,
73 with fast I/O throughput and low CPU usage. But there are at
74 least a few configurations of chipsets and drives for which DMA
75 does not make much of a difference, or may even slow things down
76 (on really messed up hardware!). Your mileage may vary.
77
78 --dco-freeze
79 DCO stands for Device Configuration Overlay, a way for vendors
80 to selectively disable certain features of a drive. The --dco-
81 freeze option will freeze/lock the current drive configuration,
82 thereby preventing software (or malware) from changing any DCO
83 settings until after the next power-on reset.
84
85 --dco-identify
86 Query and dump information regarding drive configuration set‐
87 tings which can be disabled by the vendor or OEM installer.
88 These settings show capabilities of the drive which might be
89 disabled by the vendor for "enhanced compatibility". When dis‐
90 abled, they are otherwise hidden and will not show in the -I
91 identify output. For example, system vendors sometimes disable
92 48_bit addressing on large drives, for compatibility (and loss
93 of capacity) with a specific BIOS. In such cases, --dco-iden‐
94 tify will show that the drive is 48_bit capable, but -I will not
95 show it, and nor will the drive accept 48_bit commands.
96
97 --dco-restore
98 Reset all drive settings, features, and accessible capacities
99 back to factory defaults and full capabilities. This command
100 will fail if DCO is frozen/locked, or if a -Np maximum size re‐
101 striction has also been set. This is EXTREMELY DANGEROUS and
102 will very likely cause massive loss of data. DO NOT USE THIS
103 COMMAND.
104
105 --direct
106 Use the kernel´s "O_DIRECT" flag when performing a -t timing
107 test. This bypasses the page cache, causing the reads to go di‐
108 rectly from the drive into hdparm's buffers, using so-called
109 "raw" I/O. In many cases, this can produce results that appear
110 much faster than the usual page cache method, giving a better
111 indication of raw device and driver performance.
112
113 --drq-hsm-error
114 VERY DANGEROUS, DON'T EVEN THINK ABOUT USING IT. This option
115 causes hdparm to issue an IDENTIFY command to the kernel, but
116 incorrectly marked as a "non-data" command. This results in the
117 drive being left with its DataReQust(DRQ) line "stuck" high.
118 This confuses the kernel drivers, and may crash the system imme‐
119 diately with massive data loss. The option exists to help in
120 testing and fortifying the kernel against similar real-world
121 drive malfunctions. VERY DANGEROUS, DO NOT USE!!
122
123 -D Enable/disable the on-drive defect management feature, whereby
124 the drive firmware tries to automatically manage defective sec‐
125 tors by relocating them to "spare" sectors reserved by the fac‐
126 tory for such. Control of this feature via the -D option is not
127 supported for most modern drives since ATA-4; thus this command
128 may fail.
129
130 -E Set cd/dvd drive speed. This is NOT necessary for regular oper‐
131 ation, as the drive will automatically switch speeds on its own.
132 But if you want to play with it, just supply a speed number af‐
133 ter the option, usually a number like 2 or 4. This can be use‐
134 ful in some cases, though, to smooth out DVD video playback.
135
136 -f Sync and flush the buffer cache for the device on exit. This
137 operation is also performed internally as part of the -t and -T
138 timings and other options.
139
140 --fallocate
141 This option currently works only on ext4 and xfs filesystem
142 types. When used, this must be the only option given. It re‐
143 quires two parameters: the desired file size in kilo-bytes (byte
144 count divided by 1024), followed by the pathname for the new
145 file. It will create a new file of the specified size, but
146 without actually having to write any data to the file. This
147 will normally complete very quickly, and without thrashing the
148 storage device.
149
150 E.g. Create a 10KByte file: hdparm --fallocate 10 temp_file
151
152 --fibmap
153 When used, this must be the only option given. It requires a
154 file path as a parameter, and will print out a list of the block
155 extents (sector ranges) occupied by that file on disk. Sector
156 numbers are given as absolute LBA numbers, referenced from sec‐
157 tor 0 of the physical device rather than from the partition or
158 filesystem. This information can then be used for a variety of
159 purposes, such as examining the degree of fragmenation of larger
160 files, or determining appropriate sectors to deliberately cor‐
161 rupt during fault-injection testing procedures.
162
163 This option uses the new FIEMAP (file extent map) ioctl() when
164 available, and falls back to the older FIBMAP (file block map)
165 ioctl() otherwise. Note that FIBMAP suffers from a 32-bit
166 block-number interface, and thus not work beyond 8TB or 16TB.
167 FIBMAP is also very slow, and does not deal well with preallo‐
168 cated uncommitted extents in ext4/xfs filesystems, unless a
169 sync() is done before using this option.
170
171 --fwdownload
172 When used, this should be the only option given. It requires a
173 file path immediately after the option, indicating where the new
174 drive firmware should be read from. The contents of this file
175 will be sent to the drive using the (S)ATA DOWNLOAD MICROCODE
176 command, using either transfer protocol 7 (entire file at once),
177 or, if the drive supports it, transfer protocol 3 (segmented
178 download). This command is EXTREMELY DANGEROUS and could de‐
179 stroy both the drive and all data on it. DO NOT USE THIS COM‐
180 MAND. The --fwdownload-mode3 , --fwdownload-mode3-max , and
181 --fwdownload-mode7 variations on basic --fwdownload allow over‐
182 riding automatic protocol detection in favour of forcing hdparm
183 to use a specific transfer protocol, for testing purposes only.
184
185 -F Flush the on-drive write cache buffer (older drives may not im‐
186 plement this).
187
188 -g Display the drive geometry (cylinders, heads, sectors), the size
189 (in sectors) of the device, and the starting offset (in sectors)
190 of the device from the beginning of the drive.
191
192 -h Display terse usage information (help).
193
194 -H Read the temperature from some (mostly Hitachi) drives. Also
195 reports if the temperature is within operating condition range
196 (this may not be reliable). Does not cause the drive to spin up
197 if idle.
198
199 -i Display the identification info which the kernel drivers (IDE,
200 libata) have stored from boot/configuration time. This may dif‐
201 fer from the current information obtainable directly from the
202 drive itself with the -I option. The data returned may or may
203 not be current, depending on activity since booting the system.
204 For a more detailed interpretation of the identification info,
205 refer to AT Attachment Interface for Disk Drives, ANSI ASC
206 X3T9.2 working draft, revision 4a, April 19/93, and later edi‐
207 tions.
208
209 --idle-immediate
210 Issue an ATA IDLE_IMMEDIATE command, to put the drive into a
211 lower power state. Usually the device remains spun-up.
212
213 --idle-unload
214 Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command, to unload or
215 park the heads and put the drive into a lower power state. Usu‐
216 ally the device remains spun-up.
217
218 -I Request identification info directly from the drive, which is
219 displayed in a new expanded format with considerably more detail
220 than with the older -i option.
221
222 --Iraw <pathname>
223 This option dumps the drive's identify data in raw binary to the
224 specified file.
225
226 --Istdin
227 This is a special variation on the -I option, which accepts a
228 drive identification block as standard input instead of using a
229 /dev/hd* parameter. The format of this block must be exactly
230 the same as that found in the /proc/ide/*/hd*/identify "files",
231 or that produced by the --Istdout option described below. This
232 variation is designed for use with collected "libraries" of
233 drive identification information, and can also be used on ATAPI
234 drives which may give media errors with the standard mechanism.
235 When --Istdin is used, it must be the *only* parameter given.
236
237 --Istdout
238 This option dumps the drive's identify data in hex to stdout, in
239 a format similar to that from /proc/ide/*/identify, and suitable
240 for later use with the --Istdin option.
241
242 -J Get/set the Western Digital (WD) Green Drive's "idle3" timeout
243 value. This timeout controls how often the drive parks its
244 heads and enters a low power consumption state. The factory de‐
245 fault is eight (8) seconds, which is a very poor choice for use
246 with Linux. Leaving it at the default will result in hundreds
247 of thousands of head load/unload cycles in a very short period
248 of time. The drive mechanism is only rated for 300,000 to
249 1,000,000 cycles, so leaving it at the default could result in
250 premature failure, not to mention the performance impact of the
251 drive often having to wake-up before doing routine I/O.
252
253 WD supply a WDIDLE3.EXE DOS utility for tweaking this setting,
254 and you should use that program instead of hdparm if at all pos‐
255 sible. The reverse-engineered implementation in hdparm is not
256 as complete as the original official program, even though it
257 does seem to work on at a least a few drives. A full power cy‐
258 cle is required for any change in setting to take effect, re‐
259 gardless of which program is used to tweak things.
260
261 A setting of 30 seconds is recommended for Linux use. Permitted
262 values are from 8 to 12 seconds, and from 30 to 300 seconds in
263 30-second increments. Specify a value of zero (0) to disable
264 the WD idle3 timer completely (NOT RECOMMENDED!).
265
266 -k Get/set the "keep_settings_over_reset" flag for the drive. When
267 this flag is set, the drive will preserve the -dmu settings over
268 a soft reset, (as done during the error recovery sequence).
269 This option defaults to off, to prevent drive reset loops which
270 could be caused by combinations of -dmu settings. The -k option
271 should therefore only be set after one has achieved confidence
272 in correct system operation with a chosen set of configuration
273 settings. In practice, all that is typically necessary to test
274 a configuration (prior to using -k) is to verify that the drive
275 can be read/written, and that no error logs (kernel messages)
276 are generated in the process (look in /var/log/messages on most
277 systems).
278
279 -K Set the drive´s "keep_features_over_reset" flag. Setting this
280 enables the drive to retain the settings for -APSWXZ over a soft
281 reset (as done during the error recovery sequence). Not all
282 drives support this feature.
283
284 -L Set the drive´s doorlock flag. Setting this to 1 will lock the
285 door mechanism of some removable hard drives (e.g. Syquest, ZIP,
286 Jazz..), and setting it to 0 will unlock the door mechanism.
287 Normally, Linux maintains the door locking mechanism automati‐
288 cally, depending on drive usage (locked whenever a filesystem is
289 mounted). But on system shutdown, this can be a nuisance if the
290 root partition is on a removable disk, since the root partition
291 is left mounted (read-only) after shutdown. So, by using this
292 command to unlock the door after the root filesystem is re‐
293 mounted read-only, one can then remove the cartridge from the
294 drive after shutdown.
295
296 -m Get/set sector count for multiple sector I/O on the drive. A
297 setting of 0 disables this feature. Multiple sector mode (aka
298 IDE Block Mode), is a feature of most modern IDE hard drives,
299 permitting the transfer of multiple sectors per I/O interrupt,
300 rather than the usual one sector per interrupt. When this fea‐
301 ture is enabled, it typically reduces operating system overhead
302 for disk I/O by 30-50%. On many systems, it also provides in‐
303 creased data throughput of anywhere from 5% to 50%. Some
304 drives, however (most notably the WD Caviar series), seem to run
305 slower with multiple mode enabled. Your mileage may vary. Most
306 drives support the minimum settings of 2, 4, 8, or 16 (sectors).
307 Larger settings may also be possible, depending on the drive. A
308 setting of 16 or 32 seems optimal on many systems. Western Dig‐
309 ital recommends lower settings of 4 to 8 on many of their
310 drives, due tiny (32kB) drive buffers and non-optimized buffer‐
311 ing algorithms. The -i option can be used to find the maximum
312 setting supported by an installed drive (look for MaxMultSect in
313 the output). Some drives claim to support multiple mode, but
314 lose data at some settings. Under rare circumstances, such
315 failures can result in massive filesystem corruption.
316
317 --make-bad-sector
318 Deliberately create a bad sector (aka. "media error") on the
319 disk. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!! This
320 can be useful for testing of device/RAID error recovery mecha‐
321 nisms. The sector number is given as a (base10) parameter after
322 the option. Depending on the device, hdparm will choose one of
323 two possible ATA commands for corrupting the sector. The
324 WRITE_LONG works on most drives, but only up to the 28-bit sec‐
325 tor boundary. Some very recent drives (2008) may support the
326 new WRITE_UNCORRECTABLE_EXT command, which works for any LBA48
327 sector. If available, hdparm will use that in preference to
328 WRITE_LONG. The WRITE_UNCORRECTABLE_EXT command itself presents
329 a choice of how the new bad sector should behave. By default,
330 it will look like any other bad sector, and the drive may take
331 some time to retry and fail on subsequent READs of the sector.
332 However, if a single letter f is prepended immediately in front
333 of the first digit of the sector number parameter, then hdparm
334 will issue a "flagged" WRITE_UNCORRECTABLE_EXT, which causes the
335 drive to merely flag the sector as bad (rather than genuinely
336 corrupt it), and subsequent READs of the sector will fail imme‐
337 diately (rather than after several retries). Note also that the
338 --repair-sector option can be used to restore (any) bad sectors
339 when they are no longer needed, including sectors that were gen‐
340 uinely bad (the drive will likely remap those to a fresh area on
341 the media).
342
343 -M Get/set Automatic Acoustic Management (AAM) setting. Most modern
344 harddisk drives have the ability to speed down the head move‐
345 ments to reduce their noise output. The possible values are be‐
346 tween 0 and 254. 128 is the most quiet (and therefore slowest)
347 setting and 254 the fastest (and loudest). Some drives have only
348 two levels (quiet / fast), while others may have different lev‐
349 els between 128 and 254. At the moment, most drives only sup‐
350 port 3 options, off, quiet, and fast. These have been assigned
351 the values 0, 128, and 254 at present, respectively, but integer
352 space has been incorporated for future expansion, should this
353 change.
354
355 -n Get or set the "ignore_write_errors" flag in the driver. Do NOT
356 play with this without grokking the driver source code first.
357
358 -N Get/set max visible number of sectors, also known as the Host
359 Protected Area setting. Without a parameter, -N displays the
360 current setting, which is reported as two values: the first
361 gives the current max sectors setting, and the second shows the
362 native (real) hardware limit for the disk. The difference be‐
363 tween these two values indicates how many sectors of the disk
364 are currently hidden from the operating system, in the form of a
365 Host Protected Area (HPA). This area is often used by computer
366 makers to hold diagnostic software, and/or a copy of the origi‐
367 nally provided operating system for recovery purposes. Another
368 possible use is to hide the true capacity of a very large disk
369 from a BIOS/system that cannot normally cope with drives of that
370 size (eg. most current {2010} BIOSs cannot deal with drives
371 larger than 2TB, so an HPA could be used to cause a 3TB drive to
372 report itself as a 2TB drive). To change the current max (VERY
373 DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be
374 provided (in base10) immediately following the -N option. This
375 value is specified as a count of sectors, rather than the "max
376 sector address" of the drive. Drives have the concept of a tem‐
377 porary (volatile) setting which is lost on the next hardware re‐
378 set, as well as a more permanent (non-volatile) value which sur‐
379 vives resets and power cycles. By default, -N affects only the
380 temporary (volatile) setting. To change the permanent (non-
381 volatile) value, prepend a leading p character immediately be‐
382 fore the first digit of the value. Drives are supposed to allow
383 only a single permanent change per session. A hardware reset
384 (or power cycle) is required before another permanent -N opera‐
385 tion can succeed. Note that any attempt to set this value may
386 fail if the disk is being accessed by other software at the same
387 time. This is because setting the value requires a pair of
388 back-to-back drive commands, but there is no way to prevent some
389 other command from being inserted between them by the kernel.
390 So if it fails initially, just try again. Kernel support for -N
391 is buggy for many adapter types across many kernel versions, in
392 that an incorrect (too small) max size value is sometimes re‐
393 ported. As of the 2.6.27 kernel, this does finally seem to be
394 working on most hardware.
395
396 --offset
397 Offsets to given number of GiB (1024*1024*1024) when performing
398 -t timings of device reads. Speed changes (about twice) along
399 many mechanical drives. Usually the maximum is at the begin‐
400 ning, but not always. Solid-state drives (SSDs) should show
401 similar timings regardless of offset.
402
403 -p Attempt to reprogram the IDE interface chipset for the specified
404 PIO mode, or attempt to auto-tune for the "best" PIO mode sup‐
405 ported by the drive. This feature is supported in the kernel
406 for only a few "known" chipsets, and even then the support is
407 iffy at best. Some IDE chipsets are unable to alter the PIO
408 mode for a single drive, in which case this option may cause the
409 PIO mode for both drives to be set. Many IDE chipsets support
410 either fewer or more than the standard six (0 to 5) PIO modes,
411 so the exact speed setting that is actually implemented will
412 vary by chipset/driver sophistication. Use with extreme cau‐
413 tion! This feature includes zero protection for the unwary, and
414 an unsuccessful outcome may result in severe filesystem corrup‐
415 tion!
416
417 -P Set the maximum sector count for the drive´s internal prefetch
418 mechanism. Not all drives support this feature, and it was
419 dropped from the official spec as of ATA-4.
420
421 --prefer-ata12
422 When using the SAT (SCSI ATA Translation) protocol, hdparm nor‐
423 mally prefers to use the 16-byte command format whenever possi‐
424 ble. But some USB drive enclosures don't work correctly with
425 16-byte commands. This option can be used to force use of the
426 smaller 12-byte command format with such drives. hdparm will
427 still revert to 16-byte commands for things that cannot be done
428 with the 12-byte format (e.g. sector accesses beyond 28-bits).
429
430 -q Handle the next option quietly, suppressing normal output (but
431 not error messages). This is useful for reducing screen clutter
432 when running from system startup scripts. Not applicable to the
433 -i or -v or -t or -T options.
434
435 -Q Get or set the device's command queue_depth, if supported by the
436 hardware. This only works with 2.6.xx (or later) kernels, and
437 only with device and driver combinations which support changing
438 the queue_depth. For SATA disks, this is the Native Command
439 Queuing (NCQ) queue depth.
440
441 -r Get/set read-only flag for the device. When set, Linux disal‐
442 lows write operations on the device.
443
444 -R Get/set Write-Read-Verify feature, if the drive supports it.
445 Usage: -R0 (disable) or -R1 (enable). This feature is intended
446 to have the drive firmware automatically read-back any data that
447 is written by software, to verify that the data was successfully
448 written. This is generally overkill, and can slow down disk
449 writes by as much as a factor of two (or more).
450
451 --read-sector
452 Reads from the specified sector number, and dumps the contents
453 in hex to standard output. The sector number must be given
454 (base10) after this option. hdparm will issue a low-level read
455 (completely bypassing the usual block layer read/write mecha‐
456 nisms) for the specified sector. This can be used to defini‐
457 tively check whether a given sector is bad (media error) or not
458 (doing so through the usual mechanisms can sometimes give false
459 positives).
460
461 --repair-sector
462 This is an alias for the --write-sector option. VERY DANGEROUS.
463
464 -s Enable/disable the power-on in standby feature, if supported by
465 the drive. VERY DANGEROUS. Do not use unless you are abso‐
466 lutely certain that both the system BIOS (or firmware) and the
467 operating system kernel (Linux >= 2.6.22) support probing for
468 drives that use this feature. When enabled, the drive is pow‐
469 ered-up in the standby mode to allow the controller to sequence
470 the spin-up of devices, reducing the instantaneous current draw
471 burden when many drives share a power supply. Primarily for use
472 in large RAID setups. This feature is usually disabled and the
473 drive is powered-up in the active mode (see -C above). Note
474 that a drive may also allow enabling this feature by a jumper.
475 Some SATA drives support the control of this feature by pin 11
476 of the SATA power connector. In these cases, this command may be
477 unsupported or may have no effect.
478
479 -S Put the drive into idle (low-power) mode, and also set the
480 standby (spindown) timeout for the drive. This timeout value is
481 used by the drive to determine how long to wait (with no disk
482 activity) before turning off the spindle motor to save power.
483 Under such circumstances, the drive may take as long as 30 sec‐
484 onds to respond to a subsequent disk access, though most drives
485 are much quicker. The encoding of the timeout value is somewhat
486 peculiar. A value of zero means "timeouts are disabled": the
487 device will not automatically enter standby mode. Values from 1
488 to 240 specify multiples of 5 seconds, yielding timeouts from 5
489 seconds to 20 minutes. Values from 241 to 251 specify from 1 to
490 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5
491 hours. A value of 252 signifies a timeout of 21 minutes. A
492 value of 253 sets a vendor-defined timeout period between 8 and
493 12 hours, and the value 254 is reserved. 255 is interpreted as
494 21 minutes plus 15 seconds. Note that some older drives may
495 have very different interpretations of these values.
496
497 --set-sector-size
498 For drives which support reconfiguring of the Logical Sector
499 Size, this flag can be used to specify the new desired sector
500 size in bytes. VERY DANGEROUS. This most likely will scramble
501 all data on the drive. The specified size must be one of 512,
502 520, 528, 4096, 4160, or 4224. Very few drives support values
503 other than 512 and 4096. Eg. hdparm --set-sector-size 4096
504 /dev/sdb
505
506 -t Perform timings of device reads for benchmark and comparison
507 purposes. For meaningful results, this operation should be re‐
508 peated 2-3 times on an otherwise inactive system (no other ac‐
509 tive processes) with at least a couple of megabytes of free mem‐
510 ory. This displays the speed of reading through the buffer
511 cache to the disk without any prior caching of data. This mea‐
512 surement is an indication of how fast the drive can sustain se‐
513 quential data reads under Linux, without any filesystem over‐
514 head. To ensure accurate measurements, the buffer cache is
515 flushed during the processing of -t using the BLKFLSBUF ioctl.
516
517 -T Perform timings of cache reads for benchmark and comparison pur‐
518 poses. For meaningful results, this operation should be re‐
519 peated 2-3 times on an otherwise inactive system (no other ac‐
520 tive processes) with at least a couple of megabytes of free mem‐
521 ory. This displays the speed of reading directly from the Linux
522 buffer cache without disk access. This measurement is essen‐
523 tially an indication of the throughput of the processor, cache,
524 and memory of the system under test.
525
526 --trim-sector-ranges
527 For Solid State Drives (SSDs). EXCEPTIONALLY DANGEROUS. DO NOT
528 USE THIS OPTION!! Tells the drive firmware to discard unneeded
529 data sectors, destroying any data that may have been present
530 within them. This makes those sectors available for immediate
531 use by the firmware's garbage collection mechanism, to improve
532 scheduling for wear-leveling of the flash media. This option
533 expects one or more sector range pairs immediately after the op‐
534 tion: an LBA starting address, a colon, and a sector count (max
535 65535), with no intervening spaces. EXCEPTIONALLY DANGEROUS. DO
536 NOT USE THIS OPTION!!
537
538 E.g. hdparm --trim-sector-ranges 1000:4 7894:16 /dev/sdz
539
540 --trim-sector-ranges-stdin
541 Identical to --trim-sector-ranges above, except the list of
542 lba:count pairs is read from stdin rather than being specified
543 on the command line. This can be used to avoid problems with
544 excessively long command lines. It also permits batching of
545 many more sector ranges into single commands to the drive, up to
546 the currently configured transfer limit (max_sectors_kb).
547
548 -u Get/set the interrupt-unmask flag for the drive. A setting of 1
549 permits the driver to unmask other interrupts during processing
550 of a disk interrupt, which greatly improves Linux´s responsive‐
551 ness and eliminates "serial port overrun" errors. Use this fea‐
552 ture with caution: some drive/controller combinations do not
553 tolerate the increased I/O latencies possible when this feature
554 is enabled, resulting in massive filesystem corruption. In par‐
555 ticular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable
556 (due to a hardware flaw) when this option is used with kernel
557 versions earlier than 2.0.13. Disabling the IDE prefetch fea‐
558 ture of these interfaces (usually a BIOS/CMOS setting) provides
559 a safe fix for the problem for use with earlier kernels.
560
561 -v Display some basic settings, similar to -acdgkmur for IDE. This
562 is also the default behaviour when no options are specified.
563
564 -V Display program version and exit immediately.
565
566 --verbose
567 Display extra diagnostics from some commands.
568
569 -w Perform a device reset (DANGEROUS). Do NOT use this option. It
570 exists for unlikely situations where a reboot might otherwise be
571 required to get a confused drive back into a useable state.
572
573 --write-sector
574 Writes zeros to the specified sector number. VERY DANGEROUS.
575 The sector number must be given (base10) after this option. hd‐
576 parm will issue a low-level write (completely bypassing the
577 usual block layer read/write mechanisms) to the specified sec‐
578 tor. This can be used to force a drive to repair a bad sector
579 (media error).
580
581 -W Get/set the IDE/SATA drive´s write-caching feature.
582
583 -X Set the IDE transfer mode for (E)IDE/ATA drives. This is typi‐
584 cally used in combination with -d1 when enabling DMA to/from a
585 drive on a supported interface chipset, where -X mdma2 is used
586 to select multiword DMA mode2 transfers and -X sdma1 is used to
587 select simple mode 1 DMA transfers. With systems which support
588 UltraDMA burst timings, -X udma2 is used to select UltraDMA
589 mode2 transfers (you´ll need to prepare the chipset for UltraDMA
590 beforehand). Apart from that, use of this option is seldom nec‐
591 essary since most/all modern IDE drives default to their fastest
592 PIO transfer mode at power-on. Fiddling with this can be both
593 needless and risky. On drives which support alternate transfer
594 modes, -X can be used to switch the mode of the drive only.
595 Prior to changing the transfer mode, the IDE interface should be
596 jumpered or programmed (see -p option) for the new mode setting
597 to prevent loss and/or corruption of data. Use this with ex‐
598 treme caution! For the PIO (Programmed Input/Output) transfer
599 modes used by Linux, this value is simply the desired PIO mode
600 number plus 8. Thus, a value of 09 sets PIO mode1, 10 enables
601 PIO mode2, and 11 selects PIO mode3. Setting 00 restores the
602 drive´s "default" PIO mode, and 01 disables IORDY. For multi‐
603 word DMA, the value used is the desired DMA mode number plus 32.
604 for UltraDMA, the value is the desired UltraDMA mode number plus
605 64.
606
607 -y Force an IDE drive to immediately enter the low power consump‐
608 tion standby mode, usually causing it to spin down. The current
609 power mode status can be checked using the -C option.
610
611 -Y Force an IDE drive to immediately enter the lowest power con‐
612 sumption sleep mode, causing it to shut down completely. A hard
613 or soft reset is required before the drive can be accessed again
614 (the Linux IDE driver will automatically handle issuing a reset
615 if/when needed). The current power mode status can be checked
616 using the -C option.
617
618 -z Force a kernel re-read of the partition table of the specified
619 device(s).
620
621 -Z Disable the automatic power-saving function of certain Seagate
622 drives (ST3xxx models?), to prevent them from idling/spinning-
623 down at inconvenient times.
624
625
626 ATA Security Feature Set
627
628 These switches are DANGEROUS to experiment with, and might not work
629 with some kernels. USE AT YOUR OWN RISK.
630
631 --security-help
632 Display terse usage info for all of the --security-* options.
633
634 --security-freeze
635 Freeze the drive´s security settings. The drive does not accept
636 any security commands until next power-on reset. Use this func‐
637 tion in combination with --security-unlock to protect drive from
638 any attempt to set a new password. Can be used standalone, too.
639 No other options are permitted on the command line with this
640 one.
641
642 --security-prompt-for-password
643 Prompt for the --security PWD rather than getting from the com‐
644 mand line args. This avoids having passwords show up in shell
645 history or in /proc/self/cmdline during execution.
646
647 --security-unlock PWD
648 Unlock the drive, using password PWD. Password is given as an
649 ASCII string and is padded with NULs to reach 32 bytes. The ap‐
650 plicable drive password is selected with the --user-master
651 switch (default is "user" password). No other options are per‐
652 mitted on the command line with this one.
653
654 --security-set-pass PWD
655 Lock the drive, using password PWD (Set Password) (DANGEROUS).
656 Password is given as an ASCII string and is padded with NULs to
657 reach 32 bytes. Use the special password NULL to set an empty
658 password. The applicable drive password is selected with the
659 --user-master switch (default is "user" password) and the appli‐
660 cable security mode with the --security-mode switch. No other
661 options are permitted on the command line with this one.
662
663 --security-disable PWD
664 Disable drive locking, using password PWD. Password is given as
665 an ASCII string and is padded with NULs to reach 32 bytes. The
666 applicable drive password is selected with the --user-master
667 switch (default is "user" password). No other options are per‐
668 mitted on the command line with this one.
669
670 --security-erase PWD
671 Erase (locked) drive, using password PWD (DANGEROUS). Password
672 is given as an ASCII string and is padded with NULs to reach 32
673 bytes. Use the special password NULL to represent an empty
674 password. The applicable drive password is selected with the
675 --user-master switch (default is "user" password). No other op‐
676 tions are permitted on the command line with this one.
677
678 --security-erase-enhanced PWD
679 Enhanced erase (locked) drive, using password PWD (DANGEROUS).
680 Password is given as an ASCII string and is padded with NULs to
681 reach 32 bytes. The applicable drive password is selected with
682 the --user-master switch (default is "user" password). No other
683 options are permitted on the command line with this one.
684
685 --user-master USER
686 Specifies which password (user/master) to select. Defaults to
687 user password. Only useful in combination with --security-un‐
688 lock, --security-set-pass, --security-disable, --security-erase
689 or --security-erase-enhanced.
690 u user password
691 m master password
692
693
694 --security-mode MODE
695 Specifies which security mode (high/maximum) to set. Defaults
696 to high. Only useful in combination with --security-set-pass.
697 h high security
698 m maximum security
699
700 THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR
701 OWN RISK.
702
704 /etc/hdparm.conf
705
707 As noted above, the -m sectcount and -u 1 options should be used with
708 caution at first, preferably on a read-only filesystem. Most drives
709 work well with these features, but a few drive/controller combinations
710 are not 100% compatible. Filesystem corruption may result. Backup ev‐
711 erything before experimenting!
712
713 Some options (e.g. -r for SCSI) may not work with old kernels as neces‐
714 sary ioctl()´s were not supported.
715
716 Although this utility is intended primarily for use with SATA/IDE hard
717 disk devices, several of the options are also valid (and permitted) for
718 use with SCSI hard disk devices and MFM/RLL hard disks with XT inter‐
719 faces.
720
721 The Linux kernel up until 2.6.12 (and probably later) doesn´t handle
722 the security unlock and disable commands gracefully and will segfault
723 and in some cases even panic. The security commands however might in‐
724 deed have been executed by the drive. This poor kernel behaviour makes
725 the PIO data security commands rather useless at the moment.
726
727 Note that the "security erase" and "security disable" commands have
728 been implemented as two consecutive PIO data commands and will not suc‐
729 ceed on a locked drive because the second command will not be issued
730 after the segfault. See the code for hints how patch it to work around
731 this problem. Despite the segfault it is often still possible to run
732 two instances of hdparm consecutively and issue the two necessary com‐
733 mands that way.
734
736 hdparm has been written by Mark Lord <mlord@pobox.com>, the original
737 primary developer and maintainer of the (E)IDE driver for Linux, and
738 current contributor to the libata subsystem, along with suggestions and
739 patches from many netfolk.
740
741 The disable Seagate auto-powersaving code is courtesy of Tomi Leppikan‐
742 gas(tomilepp@paju.oulu.fi).
743
744 Security freeze command by Benjamin Benz, 2005.
745
746 PIO data out security commands by Leonard den Ottolander, 2005. Some
747 other parts by Benjamin Benz and others.
748
750 http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI)
751 Interface.
752
753 http://www.serialata.org/ Serial ATA International Organization.
754
755 http://www.compactflash.org/ CompactFlash Association.
756
757
758
759Version 9.62 May 2021 HDPARM(8)