Imported upstream version 1.5
[manpages-zh.git] / raw / man8 / hdparm.8
blob2f5ef5866ecbb24c68a915a03b0048c3da8e9ea0
1 .TH HDPARM 8 "Feb 2003" "Version 5.4"
3 .SH NAME
4 hdparm \- get/set hard disk parameters
5 .SH SYNOPSIS
6 .B hdparm
7 [ flags ] [device] ..
8 .SH DESCRIPTION
9 .BI hdparm
10 provides a command line interface to various hard disk ioctls
11 supported by the stock Linux ATA/IDE device driver subsystem.
12 Some options may work correctly only with the latest kernels.
13 For best results, compile hdparm with the include files from the latest kernel source code.
14 .SH OPTIONS
15 When no flags are given,
16 .I -acdgkmnru
17 is assumed.
18 .TP
19 .I -a 
20 Get/set sector count for filesystem read-ahead.  This is used to improve
21 performance in sequential reads of large files, by prefetching additional
22 blocks in anticipation of them being needed by the running task.
23 In the current kernel version (2.0.10) this has a default setting
24 of 8 sectors (4KB).  This value seems good for most purposes,
25 but in a system where most file accesses are random seeks,
26 a smaller setting might provide better performance.
27 Also, many IDE drives also have a separate built-in read-ahead function,
28 which alleviates the need for a filesystem read-ahead in many situations.
29 .TP
30 .I -A
31 Disable/enable the IDE drive's read-lookahead feature (usually ON by default).
32 .TP
33 .I -b
34 Get/set bus state.
35 .TP
36 .I -B
37 Set Advanced Power Management feature, if the drive supports it. A low value
38 means aggressive power management and a high value means better performance. A value of 255 will disable apm on the drive.
39 .TP
40 .I -c
41 Query/enable (E)IDE 32-bit I/O support.  A numeric parameter can be
42 used to enable/disable 32-bit I/O support:
43 Currently supported values include
44 .I 0
45 to disable 32-bit I/O support,
46 .I 1
47 to enable 32-bit data transfers, and
48 .I 3
49 to enable 32-bit data transfers with a special
50 .I sync
51 sequence required by many chipsets.  The value
52 .I 3
53 works with nearly all
54 32-bit IDE chipsets, but incurs slightly more overhead.
55 Note that "32-bit" refers to data transfers across a PCI or VLB bus to the
56 interface card only; all (E)IDE drives still have only a 16-bit connection
57 over the ribbon cable from the interface card.
58 .TP
59 .I -C
60 Check the current IDE power mode status, which will always be one of
61 .B unknown
62 (drive does not support this command),
63 .B active/idle
64 (normal operation),
65 .B standby
66 (low power mode, drive has spun down),
68 .B sleeping
69 (lowest power mode, drive is completely shut down).
70 The
71 .B -S, -y, -Y,
72 and
73 .B -Z
74 flags can be used to manipulate the IDE power modes.
75 .TP
76 .I -d
77 Disable/enable the "using_dma" flag for this drive.  This option now works
78 with most combinations of drives and PCI interfaces which support DMA
79 and which are known to the IDE driver.
80 It is also a good idea to use the appropriate
81 .I -X
82 option in combination with
83 .I -d1
84 to ensure that the drive itself is programmed for the correct DMA mode,
85 although most BIOSs should do this for you at boot time.
86 Using DMA nearly always gives the best performance,
87 with fast I/O throughput and low CPU usage.
88 But there are at least a few configurations of chipsets and drives
89 for which DMA does not make much of a difference, or may even slow
90 things down (on really messed up hardware!).  Your mileage may vary.
91 .TP
92 .I -D
93 Enable/disable the on-drive defect management feature,
94 whereby the drive firmware tries to automatically manage
95 defective sectors by relocating them to "spare" sectors
96 reserved by the factory for such.
97 .TP
98 .I -E
99 Set cdrom speed.  This is NOT necessary for regular operation,
100 as the drive will automatically switch speeds on its own.
101 But if you want to play with it, just supply a speed number
102 after the option, usually a number like 2 or 4.
104 .I -f
105 Sync and flush the buffer cache for the device on exit.
106 This operation is also performed as part of the
107 .I -t
109 .I -T
110 timings.
112 .I -g
113 Display the drive geometry (cylinders, heads, sectors),
114 the size (in sectors) of the device,
115 and the starting offset (in sectors) of the device from
116 the beginning of the drive.
118 .I -h
119 Display terse usage information (help).
121 .I -i
122 Display the identification info that was obtained from the drive at
123 .I boot time,
124 if available.
125 This is a feature of modern IDE drives,
126 and may not be supported by older devices.
127 The data returned may or may not be current, depending on activity
128 since booting the system.
129 However, the current multiple sector mode count is always shown.
130 For a more detailed interpretation of the identification info,
131 refer to
132 .I AT Attachment Interface for Disk Drives
133 (ANSI ASC X3T9.2 working draft, revision 4a, April 19/93).
135 .I -I
136 Request identification info directly from the drive,
137 which is displayed in a new expanded format with considerably
138 more detail than with the older
139 .I -i
140 flag.  There is a special "no seatbelts" variation on this option,
141 .B -Istdin
142 which cannot be combined with any other options, and
143 which accepts a drive identification block as standard input
144 instead of using a /dev/hd* parameter.
145 The format of this block must be
146 .I exactly
147 the same as that found in the /proc/ide/*/hd*/identify "files".
148 This variation is designed for use with "libraries" of drive
149 identification information, and can also be used on ATAPI
150 drives which may give media errors with the standard mechanism.
152 .I -k
153 Get/set the keep_settings_over_reset flag for the drive.
154 When this flag is set, the driver will preserve the
155 .I -dmu
156 options over a soft reset, (as done during the error recovery sequence).
157 This flag defaults to off,
158 to prevent drive reset loops which could be caused by combinations of
159 .I -dmu
160 settings.  The
161 .I -k
162 flag should therefore only be set after one has achieved confidence in
163 correct system operation with a chosen set of configuration settings.
164 In practice, all that is typically necessary to test a configuration
165 (prior to using -k) is to verify that the drive can be read/written,
166 and that no error logs (kernel messages) are generated in the process
167 (look in /var/adm/messages on most systems).
169 .I -K
170 Set the drive's keep_features_over_reset flag.  Setting this enables
171 the drive to retain the settings for
172 .I -APSWXZ
173 over a soft reset (as done during the error recovery sequence).
174 Not all drives support this feature.
176 .I -L
177 Set the drive's doorlock flag.  Setting this to
178 .B 1
179 will lock the door mechanism of some removeable hard drives
180 (eg. Syquest, ZIP, Jazz..), and setting it to
181 .B 0
182 will unlock the door mechanism.  Normally, Linux
183 maintains the door locking mechanism automatically, depending on drive usage
184 (locked whenever a filesystem is mounted).  But on system shutdown, this can
185 be a nuisance if the root partition is on a removeable disk, since the root
186 partition is left mounted (read-only) after shutdown.  So, by using this
187 command to unlock the door
188 .B after
189 the root filesystem is remounted read-only, one can then remove the cartridge
190 from the drive after shutdown.
192 .I -m
193 Get/set sector count for multiple sector I/O on the drive.  A setting of
194 .B 0
195 disables this feature.  Multiple sector mode (aka IDE Block Mode), is a feature
196 of most modern IDE hard drives, permitting the transfer of multiple sectors per
197 I/O interrupt, rather than the usual one sector per interrupt.  When this
198 feature is enabled, it typically reduces operating system overhead for disk
199 I/O by 30-50%.  On many systems, it also provides increased data throughput
200 of anywhere from 5% to 50%.  Some drives, however
201 (most notably the WD Caviar series),
202 seem to run slower with multiple mode enabled.  Your mileage may vary.
203 Most drives support the minimum settings of
204 2, 4, 8, or 16 (sectors).  Larger settings may also be possible, depending on
205 the drive.  A setting of 16 or 32 seems optimal on many systems.
206 Western Digital recommends lower settings of 4 to 8 on many of their drives,
207 due tiny (32kB) drive buffers and non-optimized buffering algorithms.
209 .B -i
210 flag can be used to find the maximum setting supported by an installed drive
211 (look for MaxMultSect in the output).
212 Some drives claim to support multiple mode, but lose data at some settings.
213 Under rare circumstances, such failures can result in
214 .B massive filesystem corruption.
216 .I -M
217 Get/set Automatic Acoustic Management (AAM) setting. Most modern harddisk drives 
218 have the ability to speed down the head movements to reduce their noise output.
219 The possible values are between 0 and 254. 128 is the most quiet (and therefore
220 slowest) setting and 254 the fastest (and loudest). Some drives have ownly two 
221 levels (quiet / fast), while others may have different levels between 128 and 254.
222 .B THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
224 .I -n
225 Get or set the "ignore write errors" flag in the driver.
226 Do NOT play with this without grokking the driver source code first.
228 .I -p
229 Attempt to reprogram the IDE interface chipset for the specified PIO mode,
230 or attempt to auto-tune for the "best" PIO mode supported by the drive.
231 This feature is supported in the kernel for only a few "known" chipsets,
232 and even then the support is iffy at best.  Some IDE chipsets are unable
233 to alter the PIO mode for a single drive, in which case this flag may cause
234 the PIO mode for
235 .I both
236 drives to be set.  Many IDE chipsets support either fewer or more than the
237 standard six (0 to 5) PIO modes, so the exact speed setting that is actually
238 implemented will vary by chipset/driver sophistication.
239 .I Use with extreme caution!
240 This feature includes zero protection for the unwary,
241 and an unsuccessful outcome may result in
242 .I severe filesystem corruption!
244 .I -P
245 Set the maximum sector count for the drive's internal prefetch mechanism.
246 Not all drives support this feature.
248 .I -q
249 Handle the next flag quietly, supressing normal output.  This is useful
250 for reducing screen clutter when running from /etc/rc.c/rc.local.
251 Not applicable to the
252 .I -i
254 .I -v
256 .I -t
258 .I -T
259 flags.
261 .I -Q
262 Set tagged queue depth (1 or greater), or turn tagged queuing off (0).
263 This only works with the newer 2.5.xx (or later) kernels, and only with
264 the few drives that currently support it.
266 .I -r
267 Get/set read-only flag for device.  When set, write operations are not
268 permitted on the device.
270 .I -R
271 Register an IDE interface.
272 .B Dangerous.
273 See the
274 .B -U
275 option for more information.
277 .I -S
278 Set the standby (spindown) timeout for the drive.
279 This value is used by the drive to determine how long to wait (with no 
280 disk activity) before turning off the spindle motor to save power.
281 Under such circumstances, the drive may take as long as 30 seconds
282 to respond to a subsequent disk access, though most drives are much quicker.
283 The encoding of the timeout value is somewhat peculiar.  A value of zero
284 means "off".  Values from 1 to 240 specify multiples of 5 seconds,
285 for timeouts from 5 seconds to 20 minutes.
286 Values from 241 to 251 specify from 1 to 11 units of 30 minutes,
287 for timeouts from 30 minutes to 5.5 hours.  A value of 252 signifies
288 a timeout of 21 minutes, 253 sets a vendor-defined timeout,
289 and 255 is interpreted as 21 minutes plus 15 seconds.
291 .I -T
292 Perform timings of cache reads for benchmark and comparison purposes.
293 For meaningful results, this operation should be repeated 2-3 times
294 on an otherwise inactive system (no other active processes) with at
295 least a couple of megabytes of free memory.  This displays the speed
296 of reading directly from the Linux buffer cache without disk access.
297 This measurement is essentially an indication of the throughput of the
298 processor, cache, and memory of the system under test.
299 If the
300 .I -t
301 flag is also specified, then a correction factor based on the outcome of
302 .I -T
303 will be incorporated into the result reported for the
304 .I -t
305 operation.
307 .I -t
308 Perform timings of device reads for benchmark and comparison purposes.
309 For meaningful results, this operation should be repeated 2-3 times on
310 an otherwise inactive system (no other active processes) with at least a
311 couple of megabytes of free memory.  This displays the speed of reading
312 through the buffer cache to the disk without any prior caching of data.
313 This measurement is an indication of how fast the drive can sustain
314 sequential data reads under Linux, without any filesystem overhead.  To
315 ensure accurate measurments, the buffer cache is flushed during the
316 processing of
317 .I -t
318 using the BLKFLSBUF ioctl.
319 If the
320 .I -T
321 flag is also specified, then a correction factor based on the outcome of
322 .I -T
323 will be incorporated into the result reported for the
324 .I -t
325 operation.
327 .I -u
328 Get/set interrupt-unmask flag for the drive.  A setting of
329 .B 1
330 permits the
331 driver to unmask other interrupts during processing of a disk interrupt,
332 which greatly improves Linux's responsiveness and eliminates "serial port
333 overrun" errors.
334 .B Use this feature with caution:
335 some drive/controller combinations do
336 not tolerate the increased I/O latencies possible when this feature is enabled,
337 resulting in
338 .B massive filesystem corruption.
339 In particular,
340 .B CMD-640B
342 .B RZ1000
343 (E)IDE interfaces can be
344 .B unreliable
345 (due to a hardware flaw) when this option is used with kernel versions earlier
346 than 2.0.13.  Disabling the
347 .B IDE prefetch
348 feature of these interfaces (usually a BIOS/CMOS setting)
349 provides a safe fix for the problem for use with earlier kernels.
351 .I -U
352 Un-register an IDE interface.
353 .B Dangerous.
354 The companion for the
355 .B -R
356 option.
357 Intended for use with hardware made specifically for hot-swapping (very rare!).  
358 Use with knowledge and
359 .B extreme caution
360 as this can easily hang or damage your system.
361 The hdparm source distribution includes a 'contrib' directory with
362 some user-donated scripts for hot-swapping on the UltraBay of a ThinkPad 600E.
363 Use at your own risk.
365 .I -v 
366 Display all settings, except -i (same as -acdgkmnru for IDE, -gr for SCSI or
367 -adgr for XT).  This is also the default behaviour when no flags are specified.
369 .I -w
370 Perform a device reset (DANGEROUS).  Do NOT use this option.
371 It exists for unlikely situations where a reboot might otherwise be
372 required to get a confused drive back into a useable state.
374 .I -W
375 Disable/enable the IDE drive's write-caching feature
376 (default state is undeterminable; manufacturer/model specific).
378 .I -x 
379 Tristate device for hotswap (DANGEROUS).
381 .I -X 
382 Set the IDE transfer mode for newer (E)IDE/ATA drives.
383 This is typically used in combination with
384 .I -d1
385 when enabling DMA to/from a drive on a supported interface chipset, where
386 .I -X mdma2
387 is used to select multiword DMA mode2 transfers and
388 .I -X sdma1 
389 is used to select simple mode 1 DMA transfers.
390 With systems which support UltraDMA burst timings,
391 .I -X udma2
392 is used to select UltraDMA mode2 transfers (you'll need to prepare
393 the chipset for UltraDMA beforehand).
394 Apart from that, use of this flag is
395 .I seldom necessary
396 since most/all modern IDE drives default to their fastest PIO transfer mode
397 at power-on.  Fiddling with this can be both needless and risky.
398 On drives which support alternate transfer modes,
399 .I -X
400 can be used to switch the mode of the drive
401 .I only.
402 Prior to changing the transfer mode, the IDE interface should be jumpered
403 or programmed (see
404 .I -p
405 flag)
406 for the new mode setting to prevent loss and/or corruption of data.
407 .I Use this with extreme caution!
408 For the PIO (Programmed Input/Output)
409 transfer modes used by Linux, this value is simply the desired
410 PIO mode number plus 8.
411 Thus, a value of 09 sets PIO mode1, 10 enables PIO mode2,
412 and 11 selects PIO mode3.
413 Setting 00 restores the drive's "default" PIO mode, and 01 disables IORDY.
414 For multiword DMA, the value used is the desired DMA mode number
415 plus 32.  for UltraDMA, the value is the desired UltraDMA mode number
416 plus 64.
418 .I -y
419 Force an IDE drive to immediately enter the low power consumption
420 .B standby
421 mode, usually causing it to spin down.
422 The current power mode status can be checked using the
423 .B -C
424 flag.
426 .I -Y
427 Force an IDE drive to immediately enter the lowest power consumption
428 .B sleep
429 mode, causing it to shut down completely.  A hard or soft reset
430 is required before the drive can be accessed again
431 (the Linux IDE driver will automatically handle issuing a reset if/when needed).
432 The current power mode status can be checked using the
433 .B -C
434 flag.
436 .I -z
437 Force a kernel re-read of the partition table of the specified device(s).
439 .I -Z
440 Disable the automatic power-saving function of certain Seagate drives
441 (ST3xxx models?), to prevent them from idling/spinning-down
442 at inconvenient times.
443 .SH BUGS
444 As noted above, the
445 .B -m sectcount
447 .B -u 1
448 options should be used with caution at first, preferably on a
449 read-only filesystem.  Most drives work well with these features, but
450 a few drive/controller combinations are not 100% compatible.  Filesystem
451 corruption may result.  Backup everything before experimenting!
453 Some options (eg. -r for SCSI) may not work with old kernels as 
454 necessary ioctl()'s were not supported.
456 Although this utility is intended primarily for use with (E)IDE hard disk
457 devices, several of the options are also valid (and permitted) for use with 
458 SCSI hard disk devices and MFM/RLL hard disks with XT interfaces.
459 .SH AUTHOR
460 .B hdparm
461 has been written by Mark Lord <mlord@pobox.com>, the primary developer and
462 maintainer of the (E)IDE driver for Linux, with suggestions from many netfolk.
464 The disable Seagate auto-powersaving code
465 is courtesy of Tomi Leppikangas(tomilepp@paju.oulu.fi).
466 .SH SEE ALSO
467 .B AT Attachment Interface for Disk Drives,
468 ANSI ASC X3T9.2 working draft, revision 4a, April 19, 1993.
470 .B AT Attachment Interface with Extensions (ATA-2),
471 ANSI ASC X3T9.2 working draft, revision 2f, July 26, 1994.
473 .B AT Attachment with Packet Interface - 5 (ATA/ATAPI-5),
474 T13-1321D working draft, revision 3, February 29, 2000.
476 .B AT Attachment with Packet Interface - 6 (ATA/ATAPI-6),
477 T13-1410D working draft, revision 3b, February 26, 2002.
479 .B Western Digital Enhanced IDE Implementation Guide,
480 by Western Digital Corporation, revision 5.0, November 10, 1993.
482 .B Enhanced Disk Drive Specification,
483 by Phoenix Technologies Ltd., version 1.0, January 25, 1994.