OSDN Git Service

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