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.
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.
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.
Enable or disable the IDE read-ahead feature. Usually on by default.
Get or set the bus state for the drive.
Set the Advanced Power Management (APM) data if the drive supports it.
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).
Check 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.
Get or set the using_dma flag for the drive, which may be 0 (not using DMA) or 1 (using DMA).
Enable or disable defect-handling features that are controlled by the hard drive itself.
Set CD-ROM read speed to n times normal audio playback speed. Not normally necessary.
Flush and sync the buffer cache on exit.
Query and display drive size and geometry information, such as number of cylinders, heads, and sectors.
Display a short help message.
Display the drive identification information obtained at boot time. If the drive has changed since boot, this information may not be current.
Display more detailed identification information for the drive.
Read identify data from standard input.
Write identify data to standard output.
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).
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.
Set the door lock flag for the drive. Used for Syquest, ZIP, and JAZ drives.
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.
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.
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.
Tune 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.
Set the internal prefetch sector count. Not all drives support the feature.
Suppress output for the flag after this one, unless it is the -i, -v, -t, or -T flag.
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.
Get or set the flag for read-only on the device. A value of 1 marks the device as read-only.
This option should be used by experts only. It registers an IDE interface. See the -U option for further details.
Set 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.
Time cache reads to determine performance.
Time device reads to determine performance.
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.
Unregister 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.
Display all appropriate settings for device except -i. This is the same as the default behavior with no flags.
Reset the device. Use as a last resort only; may cause data loss.
Enable or disable the write-cache feature for the drive. The default varies among drive manufacturers.
Sets tristate. Use only for hot-swappable devices. See the -R and -U entries.
Set 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.
Put the IDE drive into standby (spin-down) mode, saving power.
Put the IDE drive into sleep mode.
Force the kernel to reread the partition table.
Disable 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.