hdparm

From Wikipedia, the free encyclopedia


hdparm is a command line utility for the Linux operating system to set and view IDE hard disk hardware parameters. It can set parameters such as drive caches, sleep mode, power management, acoustic management, and DMA settings.

Changing hardware parameters from suboptimal conservative defaults to their optimal settings can improve performance greatly. For example, turning on DMA can in some instances double or triple data throughput. Unfortunately at present there's no reliable method for determining the optimal settings for a given controller/drive combination, except careful trial and error; nor is there yet any central database that collects and shares the combined experience of hdparm users.

hdparm has a more serious drawback: it can crash a computer and make data on its disk inaccessible if certain parameters are misused. Out of approximately forty parameters, seven are dangerous and may result in "massive filesystem corruption":

  • -m set multiple sector I/O count
  • -n set "ignore write errors" flag
  • -p set PIO mode
  • -u set interrupt-unmask flag
  • -U unregister IDE interface
  • -w reset a device
  • -X set IDE transfer mode

Before using hdparm it is important to read its man page, and (if testing any of its seven dangerous parameters) to have a full backup of everything on the drive.

hdparm is free software under the BSD license.

[edit] Usage

hdparm [flags] [device]

Important: hpdarm has to be run with root privileges, otherwise it will either not be found or not be executed properly.

Examples:

Turn on DMA for the first hard drive.

hdparm -d1 /dev/hda

Turn off DMA for the first hard drive.

hdparm -d0 /dev/hda

Test cache read performance of the first hard drive

hdparm -T /dev/hda

Test read performance of the first hard drive

hdparm -t /dev/hda

[edit] External links