The hdparm Command

The hdparm utility can be used by root to set and tune the settings for IDE hard drives. You would do this to tune the drives for optimal performance.

Once a kernel patch and associated support programs, the hdparm program is now included with Ubuntu. You should only experiment with the drives mounted read-only because some settings can damage some file systems when used improperly. The hdparm command also works with CD-ROM drives and some SCSI drives.

The general format of the command is this:

# hdparm command device

This command runs a hard disk test:

hdparm tT /dev/hda

You will need to replace /dev/hda with the location of your hard disk. hdparm will then run two testscached reads and buffered disk reads. A good IDE hard disk should be getting 400-500MB/sec for the first test, and 20-30MB/sec for the second. Note your scores, then try this command:

hdparm m16 d1 u1 cl /dev/hda

That enables various performance-enhancing settings. Now try executing the original command againif you see an increase, then you should run this command:

hdparm m16 d1 u1 cl k1 /dev/hda

The extra parameter tells hdparm to write the settings to disk so they will be used each time you boot upensuring optimal disk performance in the future.

The man entry for hdparm is extensive and contains useful detailed information, but since the kernel configuration selected by Ubuntu already attempts to optimize the drives, it might be that little can be gained through tweaking. Because not all hardware combinations can be anticipated by Ubuntu or by Linux and performance gains are always useful, you're encouraged to try.

You can use the hdparm command to produce a disk transfer speed result with

# hdparm -tT device

Be aware, however, that although the resulting numbers appear quantitative, they are subject to several technical qualifications beyond the scope of what is discussed and explained in this chapter. Simply put, do not accept values generated by hdparm as absolute numbers, but only as a relative measure of performance.

Was this article helpful?

0 0

Post a comment