Книга: Fedora™ Unleashed, 2008 edition

The hdparm Command

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 an associated support program, the hdparm program is now included with Fedora. You should experiment only 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/sda

You need to replace /dev/sda with the location of your hard disk. hdparm then runs 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, and then try this command:

# hdparm -m16 -d1 -u1 -c1 /dev/sda

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

$ hdparm -m16 -d1 -u1 -c1 -k1 /dev/sda

The extra parameter tells hdparm to write the settings to disk so that 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 because the kernel configuration selected by Fedora 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 Fedora or by Linux and performance gains are always useful, you're encouraged to try.

TIP

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

# 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 as only a relative measure of performance.

Systemwide tweaks to hdparm are formally handled through the /etc/sysconfig/harddisks files, but this file's use is poorly documented and, therefore, of little use.

TIP

You might find that your system turns off DMA for any CD-RW drives detected via a shell script command in rc.sysinit. This might not be appropriate for your hardware, so you can turn it back on simply by adding the line options ide-cd dma=1 to /etc/modules.conf.

Оглавление книги


Генерация: 1.647. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз