hdparm
时间:2006-08-13 来源:anima
hdparm
hdparm [options] [device]
System administration command. Read or set the hard drive parameters. This command can be used to tune hard drive performance; it is mostly used with IDE drives, but can also be used with SCSI drives.
Options
The hdparm command accepts many option flags, including some that can result in filesystem corruption if misused. Flags can be used to set or get a parameter. To get a parameter, just pass the flag without a value. To set a parameter, follow the flag with a space and the appropriate value.
-a [n]Get or set the number of sectors to read ahead in the disk. The default is 8 sectors (4 KB); a larger value is more efficient for large, sequential reads, and a smaller value is better for small, random reads. Many IDE drives include this functionality in the drive itself, so this feature is not always necessary.
-AEnable or disable the IDE read-ahead feature. Usually on by default.
-b [n]Get or set the bus state for the drive.
-BSet the Advanced Power Management (APM) data if the drive supports it.
-c [n]Get or set 32-bit I/O values for IDE drives. Acceptable values are 0 (32-bit support off), 1 (32-bit support on), and 3 (on, but only with a sync sequence).
-CCheck the power status of the drive. This will tell you unknown, active/idle, standby, or sleeping. Use -S, -y, -Y, and -Z to set the power status.
-d [n]Get or set the using_dma flag for the drive, which may be 0 (not using DMA) or 1 (using DMA).
-DEnable or disable defect-handling features that are controlled by the hard drive itself.
-E nSet CD-ROM read speed to n times normal audio playback speed. Not normally necessary.
-fFlush and sync the buffer cache on exit.
-gQuery and display drive size and geometry information, such as number of cylinders, heads, and sectors.
-hDisplay a short help message.
-iDisplay the drive identification information obtained at boot time. If the drive has changed since boot, this information may not be current.
-IDisplay more detailed identification information for the drive.
-IstdinRead identify data from standard input.
-IstdoutWrite identify data to standard output.
-k [n]Get or set the keep_settings_over_reset variable. Valid settings are 0 and 1, and a value of 1 will keep the -dmu options when rebooting (soft reset only).
-K [n]Get or set the keep_features_over_reset variable. Valid settings are 0 and 1, and a value of 1 will keep settings for the flags -APSWXZ over a soft reset.
-L nSet the door lock flag for the drive. Used for Syquest, ZIP, and JAZ drives.
-m [n]Get or set the number of sectors used for multiple sector count reading. A value of 0 disables the feature, and values of 2, 4, 8, 16, and 32 are common. Drives that try to support this feature and fail may suffer corruption and data loss.
-M [n]Get or set the level for Automatic Acousting Management (AAM) features. Newer drives support this feature, which can slow down head movements to reduce hard disk noise. Values range from 128 (quiet, but slow) to 254 (fast, but loud). Some drives support only 128 and 254, while others support multiple levels between the extremes. At the time of writing, this feature was still considered experimental and not recommended for production use.
-n [n]Set to 0 or 1 to disable or enable, respectively, the "ignore write errors" flag. This can cause massive data loss if used incorrectly, and is for development purposes only.
-p nTune the IDE interface to use PIO mode n, usually an integer between 0 and 5. Incorrect values can result in massive data loss. Support for the PIO mode-setting feature varies between IDE chips, so tuning it is not for the faint of heart.
-P nSet the internal prefetch sector count. Not all drives support the feature.
-qSuppress output for the flag after this one, unless it is the -i, -v, -t, or -T flag.
-Q [n]Set the depth of tagged queues. 0 disables tagged queues. This is supported only on specific drives, and only for kernels 2.5.x and later.
-r [n]Get or set the flag for read-only on the device. A value of 1 marks the device as read-only.
-RThis option should be used by experts only. It registers an IDE interface. See the -U option for further details.
-S nSet the amount of time a disk is inactive before it spins down and goes into standby mode. Settings from 1 to 240 represent chunks of five seconds (for timeout values between 5 seconds and 20 minutes); values from 241 to 251 are increments of 30 minutes (for 30 minutes to 5.5 hours). A value of 252 sets the timeout to 21 minutes, 253 to the vendor default, and 255 to 20 minutes and 15 seconds.
-TTime cache reads to determine performance.
-tTime device reads to determine performance.
-u [n]Get or set the interrupt-unmask value for the drive. A value of 1 lets the drive unmask other interrupts and can improve performance; when used with older kernels and hardware, it can cause data loss.
-UUnregister an IDE interface. Use this feature and the -R feature only with hot-swappable hardware, such as very high-end servers and some laptops. It can damage or hang other systems, and should be used with caution.
-vDisplay all appropriate settings for device except -i. This is the same as the default behavior with no flags.
-wReset the device. Use as a last resort only; may cause data loss.
-WEnable or disable the write-cache feature for the drive. The default varies among drive manufacturers.
-xSets tristate. Use only for hot-swappable devices. See the -R and -U entries.
-X nSet the IDE transfer mode. Possible values include 34 (multiword DMA mode2 transfers) and 66 (UltraDMA mode2 transfers), or any PIO mode number plus 8. This option is suggested for experts only, and is useful only with newer EIDE/IDE/ATA2 drives. Often used in combination with -d.
-yPut the IDE drive into standby (spin-down) mode, saving power.
-YPut the IDE drive into sleep mode.
-zForce the kernel to reread the partition table.
-ZDisable automatic powersaving on some drives, which can prevent them from idling or spinning down at inconvenient moments. This will increase the electrical power consumption of your system.