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 tests—cached 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 –c1 /dev/hda

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

hdparm –m16 –d1 –u1 –c1 –k1 /dev/hda

The extra parameter tells hdparm to write the settings to disk so they will be used each time you boot up—ensuring 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.

Source of Information : Sams Ubuntu Unleashed 2008 Edition


Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs