1HDPARM(8) System Manager's Manual HDPARM(8)
2
3
4
6 hdparm - get/set hard disk parameters
7
9 hdparm [ flags ] [device] ..
10
12 hdparm provides a command line interface to various hard disk ioctls
13 supported by the Linux SATA/PATA/SAS "libata" subsystem and the older
14 IDE driver subsystem. Some options may work correctly only with the
15 latest kernels.
16
18 When no flags are given, -acdgkmur is assumed.
19
20 -a Get/set sector count for filesystem (software) read-ahead. This
21 is used to improve performance in sequential reads of large
22 files, by prefetching additional blocks in anticipation of them
23 being needed by the running task. Many IDE drives also have a
24 separate built-in read-ahead function, which augments this
25 filesystem (software) read-ahead function.
26
27 -A Get/set the IDE drive´s read-lookahead feature (usually ON by
28 default). Usage: -A0 (disable) or -A1 (enable).
29
30 -b Get/set bus state.
31
32 -B Set Advanced Power Management feature, if the drive supports it.
33 A low value means aggressive power management and a high value
34 means better performance. A value of 255 will disable apm on the
35 drive.
36
37 -c Query/enable (E)IDE 32-bit I/O support. A numeric parameter can
38 be used to enable/disable 32-bit I/O support: Currently sup‐
39 ported values include 0 to disable 32-bit I/O support, 1 to
40 enable 32-bit data transfers, and 3 to enable 32-bit data trans‐
41 fers with a special sync sequence required by many chipsets.
42 The value 3 works with nearly all 32-bit IDE chipsets, but
43 incurs slightly more overhead. Note that "32-bit" refers to
44 data transfers across a PCI or VLB bus to the interface card
45 only; all (E)IDE drives still have only a 16-bit connection over
46 the ribbon cable from the interface card.
47
48 -C Check the current IDE power mode status, which will always be
49 one of unknown (drive does not support this command),
50 active/idle (normal operation), standby (low power mode, drive
51 has spun down), or sleeping (lowest power mode, drive is com‐
52 pletely shut down). The -S, -y, -Y, and -Z flags can be used to
53 manipulate the IDE power modes.
54
55 -d Disable/enable the "using_dma" flag for this drive. This option
56 now works with most combinations of drives and PCI interfaces
57 which support DMA and which are known to the kernel IDE driver.
58 It is also a good idea to use the appropriate -X option in com‐
59 bination with -d1 to ensure that the drive itself is programmed
60 for the correct DMA mode, although most BIOSs should do this for
61 you at boot time. Using DMA nearly always gives the best per‐
62 formance, with fast I/O throughput and low CPU usage. But there
63 are at least a few configurations of chipsets and drives for
64 which DMA does not make much of a difference, or may even slow
65 things down (on really messed up hardware!). Your mileage may
66 vary.
67
68 --direct
69 Use the kernel O_DIRECT flag when performing a -t timing test.
70 This bypasses the page cache, causing the reads to go directly
71 from the drive into hdparm's buffers, using so-called "raw" I/O.
72 In many cases, this can produce results that appear much faster
73 than the usual page cache method, giving a better indication of
74 raw device and driver performance.
75
76 --drq-hsm-error
77 VERY DANGEROUS, DON'T EVEN THINK ABOUT USING IT. This flag
78 causes hdparm to issue an IDENTIFY command to the kernel, but
79 incorrectly marked as a "non-data" command. This results in the
80 drive being left with its DataReQust(DRQ) line "stuck" high.
81 This confuses the kernel drivers, and may crash the system imme‐
82 diately with massive data loss. The option exists to help in
83 testing and fortifying the kernel against similar real-world
84 drive malfunctions. VERY DANGEROUS, DO NOT USE!!
85
86 -D Enable/disable the on-drive defect management feature, whereby
87 the drive firmware tries to automatically manage defective sec‐
88 tors by relocating them to "spare" sectors reserved by the fac‐
89 tory for such. Control of this feature via the -D flag is not
90 supported for most modern drives since ATA-4; thus this command
91 may fail.
92
93 -E Set cdrom speed. This is NOT necessary for regular operation,
94 as the drive will automatically switch speeds on its own. But
95 if you want to play with it, just supply a speed number after
96 the option, usually a number like 2 or 4.
97
98 -f Sync and flush the buffer cache for the device on exit. This
99 operation is also performed as part of the -t and -T timings.
100
101 -F Flush the on-drive write cache buffer (older drives may not
102 implement this).
103
104 -g Display the drive geometry (cylinders, heads, sectors), the size
105 (in sectors) of the device, and the starting offset (in sectors)
106 of the device from the beginning of the drive.
107
108 -h Display terse usage information (help).
109
110 -i Display the identification info that was obtained from the drive
111 at boot time, if available. This is a feature of modern IDE
112 drives, and may not be supported by older devices. The data
113 returned may or may not be current, depending on activity since
114 booting the system. However, the current multiple sector mode
115 count is always shown. For a more detailed interpretation of
116 the identification info, refer to AT Attachment Interface for
117 Disk Drives (ANSI ASC X3T9.2 working draft, revision 4a, April
118 19/93).
119
120 -I Request identification info directly from the drive, which is
121 displayed in a new expanded format with considerably more detail
122 than with the older -i flag.
123
124 --Istdin
125 This is a special variation on the -I option, which accepts a
126 drive identification block as standard input instead of using a
127 /dev/hd* parameter. The format of this block must be exactly
128 the same as that found in the /proc/ide/*/hd*/identify "files",
129 or that produced by the --Istdout option described below. This
130 variation is designed for use with collected "libraries" of
131 drive identification information, and can also be used on ATAPI
132 drives which may give media errors with the standard mechanism.
133 When --Istdin is used, it must be the *only* parameter given.
134
135 --Istdout
136 This option dumps the drive's identify data in hex to stdout, in
137 a format similar to that from /proc/ide/*/identify, and suitable
138 for later use with the --Istdin option.
139
140 -k Get/set the keep_settings_over_reset flag for the drive. When
141 this flag is set, the driver will preserve the -dmu options over
142 a soft reset, (as done during the error recovery sequence).
143 This flag defaults to off, to prevent drive reset loops which
144 could be caused by combinations of -dmu settings. The -k flag
145 should therefore only be set after one has achieved confidence
146 in correct system operation with a chosen set of configuration
147 settings. In practice, all that is typically necessary to test
148 a configuration (prior to using -k) is to verify that the drive
149 can be read/written, and that no error logs (kernel messages)
150 are generated in the process (look in /var/adm/messages on most
151 systems).
152
153 -K Set the drive´s keep_features_over_reset flag. Setting this
154 enables the drive to retain the settings for -APSWXZ over a soft
155 reset (as done during the error recovery sequence). Not all
156 drives support this feature.
157
158 -L Set the drive´s doorlock flag. Setting this to 1 will lock the
159 door mechanism of some removable hard drives (eg. Syquest, ZIP,
160 Jazz..), and setting it to 0 will unlock the door mechanism.
161 Normally, Linux maintains the door locking mechanism automati‐
162 cally, depending on drive usage (locked whenever a filesystem is
163 mounted). But on system shutdown, this can be a nuisance if the
164 root partition is on a removeable disk, since the root partition
165 is left mounted (read-only) after shutdown. So, by using this
166 command to unlock the door after the root filesystem is
167 remounted read-only, one can then remove the cartridge from the
168 drive after shutdown.
169
170 -m Get/set sector count for multiple sector I/O on the drive. A
171 setting of 0 disables this feature. Multiple sector mode (aka
172 IDE Block Mode), is a feature of most modern IDE hard drives,
173 permitting the transfer of multiple sectors per I/O interrupt,
174 rather than the usual one sector per interrupt. When this fea‐
175 ture is enabled, it typically reduces operating system overhead
176 for disk I/O by 30-50%. On many systems, it also provides
177 increased data throughput of anywhere from 5% to 50%. Some
178 drives, however (most notably the WD Caviar series), seem to run
179 slower with multiple mode enabled. Your mileage may vary. Most
180 drives support the minimum settings of 2, 4, 8, or 16 (sectors).
181 Larger settings may also be possible, depending on the drive. A
182 setting of 16 or 32 seems optimal on many systems. Western Dig‐
183 ital recommends lower settings of 4 to 8 on many of their
184 drives, due tiny (32kB) drive buffers and non-optimized buffer‐
185 ing algorithms. The -i flag can be used to find the maximum
186 setting supported by an installed drive (look for MaxMultSect in
187 the output). Some drives claim to support multiple mode, but
188 lose data at some settings. Under rare circumstances, such
189 failures can result in massive filesystem corruption.
190
191 -M Get/set Automatic Acoustic Management (AAM) setting. Most modern
192 harddisk drives have the ability to speed down the head move‐
193 ments to reduce their noise output. The possible values are
194 between 0 and 254. 128 is the most quiet (and therefore slowest)
195 setting and 254 the fastest (and loudest). Some drives have only
196 two levels (quiet / fast), while others may have different lev‐
197 els between 128 and 254. At the moment, most drives only sup‐
198 port 3 options, off, quiet, and fast. These have been assigned
199 the values 0, 128, and 254 at present, respectively, but integer
200 space has been incorporated for future expansion, should this
201 change.
202
203 -n Get or set the "ignore write errors" flag in the driver. Do NOT
204 play with this without grokking the driver source code first.
205
206 -p Attempt to reprogram the IDE interface chipset for the specified
207 PIO mode, or attempt to auto-tune for the "best" PIO mode sup‐
208 ported by the drive. This feature is supported in the kernel
209 for only a few "known" chipsets, and even then the support is
210 iffy at best. Some IDE chipsets are unable to alter the PIO
211 mode for a single drive, in which case this flag may cause the
212 PIO mode for both drives to be set. Many IDE chipsets support
213 either fewer or more than the standard six (0 to 5) PIO modes,
214 so the exact speed setting that is actually implemented will
215 vary by chipset/driver sophistication. Use with extreme cau‐
216 tion! This feature includes zero protection for the unwary, and
217 an unsuccessful outcome may result in severe filesystem corrup‐
218 tion!
219
220 -P Set the maximum sector count for the drive´s internal prefetch
221 mechanism. Not all drives support this feature, and it was
222 dropped from the offical spec as of ATA-4.
223
224 -q Handle the next flag quietly, suppressing normal output (but not
225 error messages). This is useful for reducing screen clutter
226 when running from system startup scripts. Not applicable to the
227 -i or -v or -t or -T flags.
228
229 -Q Set tagged queue depth (1 or greater), or turn tagged queuing
230 off (0). This only works with the newer 2.5.xx (or later) ker‐
231 nels, and only with the few drives that currently support it.
232
233 -r Get/set read-only flag for the device. When set, Linux disal‐
234 lows write operations on the device.
235
236 -R Register an IDE interface (DANGEROUS). See the -U option for
237 more information.
238
239 -s Enable/disable the power-on in standby feature, if supported by
240 the drive. VERY DANGEROUS. Do not use unless you are abso‐
241 lutely certain that both the system BIOS (or firmware) and the
242 operating system kernel (Linux >= 2.6.22) support probing for
243 drives that use this feature. When enabled, the drive is pow‐
244 ered-up in the standby mode to allow the controller to sequence
245 the spin-up of devices, reducing the instantaneous current draw
246 burden when many drives share a power supply. Primarily for use
247 in large RAID setups. This feature is usually disabled and the
248 drive is powered-up in the active mode (see -C above). Note
249 that a drive may also allow enabling this feature by a jumper.
250 Some SATA drives support the control of this feature by pin 11
251 of the SATA power connector. In these cases, this command may be
252 unsupported or may have no effect.
253
254 -S Set the standby (spindown) timeout for the drive. This value is
255 used by the drive to determine how long to wait (with no disk
256 activity) before turning off the spindle motor to save power.
257 Under such circumstances, the drive may take as long as 30 sec‐
258 onds to respond to a subsequent disk access, though most drives
259 are much quicker. The encoding of the timeout value is somewhat
260 peculiar. A value of zero means "timeouts are disabled": the
261 device will not automatically enter standby mode. Values from 1
262 to 240 specify multiples of 5 seconds, yielding timeouts from 5
263 seconds to 20 minutes. Values from 241 to 251 specify from 1 to
264 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5
265 hours. A value of 252 signifies a timeout of 21 minutes. A
266 value of 253 sets a vendor-defined timeout period between 8 and
267 12 hours, and the value 254 is reserved. 255 is interpreted as
268 21 minutes plus 15 seconds. Note that some older drives may
269 have very different interpretations of these values.
270
271 -T Perform timings of cache reads for benchmark and comparison pur‐
272 poses. For meaningful results, this operation should be
273 repeated 2-3 times on an otherwise inactive system (no other
274 active processes) with at least a couple of megabytes of free
275 memory. This displays the speed of reading directly from the
276 Linux buffer cache without disk access. This measurement is
277 essentially an indication of the throughput of the processor,
278 cache, and memory of the system under test.
279
280 -t Perform timings of device reads for benchmark and comparison
281 purposes. For meaningful results, this operation should be
282 repeated 2-3 times on an otherwise inactive system (no other
283 active processes) with at least a couple of megabytes of free
284 memory. This displays the speed of reading through the buffer
285 cache to the disk without any prior caching of data. This mea‐
286 surement is an indication of how fast the drive can sustain
287 sequential data reads under Linux, without any filesystem over‐
288 head. To ensure accurate measurements, the buffer cache is
289 flushed during the processing of -t using the BLKFLSBUF ioctl.
290
291 -u Get/set interrupt-unmask flag for the drive. A setting of 1
292 permits the driver to unmask other interrupts during processing
293 of a disk interrupt, which greatly improves Linux´s responsive‐
294 ness and eliminates "serial port overrun" errors. Use this fea‐
295 ture with caution: some drive/controller combinations do not
296 tolerate the increased I/O latencies possible when this feature
297 is enabled, resulting in massive filesystem corruption. In par‐
298 ticular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable
299 (due to a hardware flaw) when this option is used with kernel
300 versions earlier than 2.0.13. Disabling the IDE prefetch fea‐
301 ture of these interfaces (usually a BIOS/CMOS setting) provides
302 a safe fix for the problem for use with earlier kernels.
303
304 -U Un-register an IDE interface (DANGEROUS). The companion for the
305 -R option. Intended for use with hardware made specifically for
306 hot-swapping (very rare!). Use with knowledge and extreme cau‐
307 tion as this can easily hang or damage your system. The hdparm
308 source distribution includes a ´contrib´ directory with some
309 user-donated scripts for hot-swapping on the UltraBay of a
310 ThinkPad 600E. Use at your own risk.
311
312 -v Display some basic settings, similar to -acdgkmur for IDE. This
313 is also the default behaviour when no flags are specified.
314
315 --verbose
316 Display extra diagnostics from some commands.
317
318 -w Perform a device reset (DANGEROUS). Do NOT use this option. It
319 exists for unlikely situations where a reboot might otherwise be
320 required to get a confused drive back into a useable state.
321
322 -W Get/set the IDE/SATA drive´s write-caching feature.
323
324 -x Tristate device for hotswap (DANGEROUS).
325
326 -X Set the IDE transfer mode for newer (E)IDE/ATA drives. This is
327 typically used in combination with -d1 when enabling DMA to/from
328 a drive on a supported interface chipset, where -X mdma2 is used
329 to select multiword DMA mode2 transfers and -X sdma1 is used to
330 select simple mode 1 DMA transfers. With systems which support
331 UltraDMA burst timings, -X udma2 is used to select UltraDMA
332 mode2 transfers (you´ll need to prepare the chipset for UltraDMA
333 beforehand). Apart from that, use of this flag is seldom neces‐
334 sary since most/all modern IDE drives default to their fastest
335 PIO transfer mode at power-on. Fiddling with this can be both
336 needless and risky. On drives which support alternate transfer
337 modes, -X can be used to switch the mode of the drive only.
338 Prior to changing the transfer mode, the IDE interface should be
339 jumpered or programmed (see -p flag) for the new mode setting to
340 prevent loss and/or corruption of data. Use this with extreme
341 caution! For the PIO (Programmed Input/Output) transfer modes
342 used by Linux, this value is simply the desired PIO mode number
343 plus 8. Thus, a value of 09 sets PIO mode1, 10 enables PIO
344 mode2, and 11 selects PIO mode3. Setting 00 restores the
345 drive´s "default" PIO mode, and 01 disables IORDY. For multi‐
346 word DMA, the value used is the desired DMA mode number plus 32.
347 for UltraDMA, the value is the desired UltraDMA mode number plus
348 64.
349
350 -y Force an IDE drive to immediately enter the low power consump‐
351 tion standby mode, usually causing it to spin down. The current
352 power mode status can be checked using the -C flag.
353
354 -Y Force an IDE drive to immediately enter the lowest power con‐
355 sumption sleep mode, causing it to shut down completely. A hard
356 or soft reset is required before the drive can be accessed again
357 (the Linux IDE driver will automatically handle issuing a reset
358 if/when needed). The current power mode status can be checked
359 using the -C flag.
360
361 -z Force a kernel re-read of the partition table of the specified
362 device(s).
363
364 -Z Disable the automatic power-saving function of certain Seagate
365 drives (ST3xxx models?), to prevent them from idling/spinning-
366 down at inconvenient times.
367
368 -H Read the temperature from some (mostly Hitachi) drives. Also
369 reports if the temperature is within operating condition range
370 (this may not be reliable). Does not cause the drive to spin up
371 if idle.
372
373
374 ATA Security Feature Set
375
376 These switches are DANGEROUS to experiment with, and might not work
377 with every kernel. USE AT YOUR OWN RISK.
378
379 --security-help
380 Display terse usage info for all of the --security-* flags.
381
382 --security-freeze
383 Freeze the drive´s security settings. The drive does not accept
384 any security commands until next power-on reset. Use this func‐
385 tion in combination with --security-unlock to protect drive from
386 any attempt to set a new password. Can be used standalone, too.
387
388 --security-unlock PWD
389 Unlock the drive, using password PWD. Password is given as an
390 ASCII string and is padded with NULs to reach 32 bytes. The
391 applicable drive password is selected with the --user-master
392 switch. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE
393 AT YOUR OWN RISK.
394
395 --security-set-pass PWD
396 Lock the drive, using password PWD (Set Password) (DANGEROUS).
397 Password is given as an ASCII string and is padded with NULs to
398 reach 32 bytes. The applicable drive password is selected with
399 the --user-master switch and the applicable security mode with
400 the --security-mode switch. THIS FEATURE IS EXPERIMENTAL AND
401 NOT WELL TESTED. USE AT YOUR OWN RISK.
402
403 --security-disable PWD
404 Disable drive locking, using password PWD. Password is given as
405 an ASCII string and is padded with NULs to reach 32 bytes. The
406 applicable drive password is selected with the --user-master
407 switch. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE
408 AT YOUR OWN RISK.
409
410 --security-erase PWD
411 Erase (locked) drive, using password PWD (DANGEROUS). Password
412 is given as an ASCII string and is padded with NULs to reach 32
413 bytes. The applicable drive password is selected with the
414 --user-master switch. THIS FEATURE IS EXPERIMENTAL AND NOT WELL
415 TESTED. USE AT YOUR OWN RISK.
416
417 --security-erase-enhanced PWD
418 Enhanced erase (locked) drive, using password PWD (DANGEROUS).
419 Password is given as an ASCII string and is padded with NULs to
420 reach 32 bytes. The applicable drive password is selected with
421 the --user-master switch. THIS FEATURE IS EXPERIMENTAL AND NOT
422 WELL TESTED. USE AT YOUR OWN RISK.
423
424 --user-master USER
425 Specifies which password (user/master) to select. Defaults to
426 master. Only useful in combination with --security-unlock,
427 --security-set-pass, --security-disable, --security-erase or
428 --security-erase-enhanced.
429 u user password
430 m master password
431
432 THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR
433 OWN RISK.
434
435 --security-mode MODE
436 Specifies which security mode (high/maximum) to set. Defaults
437 to high. Only useful in combination with --security-set-pass.
438 h high security
439 m maximum security
440
441 THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR
442 OWN RISK.
443
445 As noted above, the -m sectcount and -u 1 options should be used with
446 caution at first, preferably on a read-only filesystem. Most drives
447 work well with these features, but a few drive/controller combinations
448 are not 100% compatible. Filesystem corruption may result. Backup
449 everything before experimenting!
450
451 Some options (eg. -r for SCSI) may not work with old kernels as neces‐
452 sary ioctl()´s were not supported.
453
454 Although this utility is intended primarily for use with (E)IDE hard
455 disk devices, several of the options are also valid (and permitted) for
456 use with SCSI hard disk devices and MFM/RLL hard disks with XT inter‐
457 faces.
458
459 The Linux kernel up until 2.6.12 (and probably later) doesn´t handle
460 the security unlock and disable commands gracefully and will segfault
461 and in some cases even panic. The security commands however might
462 indeed have been executed by the drive. This poor kernel behaviour
463 makes the PIO data security commands rather useless at the moment.
464
465 Note that the "security erase" and "security disable" commands have
466 been implemented as two consecutive PIO data commands and will not suc‐
467 ceed on a locked drive because the second command will not be issued
468 after the segfault. See the code for hints how patch it to work around
469 this problem. Despite the segfault it is often still possible to run
470 two instances of hdparm consecutively and issue the two necessary com‐
471 mands that way.
472
474 hdparm has been written by Mark Lord <mlord@pobox.com>, the original
475 primary developer and maintainer of the (E)IDE driver for Linux, with
476 suggestions from many netfolk.
477
478 The disable Seagate auto-powersaving code is courtesy of Tomi Leppikan‐
479 gas(tomilepp@paju.oulu.fi).
480
481 Security freeze command by Benjamin Benz <bbe@heise.de>, 2005.
482
483 PIO data out security commands by Leonard den Ottolander <leonard den
484 ottolander nl>, 2005. Parts by Benjamin Benz <bbe@heise.de> and oth‐
485 ers.
486
488 http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI)
489 Interface.
490
491 http://www.serialata.org/ Serial ATA International Organization.
492
493 http://www.compactflash.org/ CompactFlash Association
494
495
496
497Version 7.7 August 2007 HDPARM(8)