One method of tuning involves adjusting the settings in your BIOS. Because the BIOS is not Linux and every BIOS seems different, always read your motherboard manual for better possible settings and make certain that all the drives are detected correctly by the BIOS. Change only one setting at a time.
Linux does provide a limited means to interact with BIOS settings during the boot process (mostly overriding them). In this section, you will learn about those commands.
Other options are in the following list, and are more fully outlined in the BOOTPROMPT HOWTO and the kernel documentation. These commands can be used to force the IDE controllers and drives to be optimally configured. Of course, YMMV (your mileage may vary) because these do not work for everyone:
> ide
> ide
— This command attempts to tune the interface for optimal performance.
> ide
> hd
— This command enables SCSI emulation of an IDE drive. This is required for some CD-RW drives to work properly in write mode and it might provide some performance improvements for regular CD-R drives, too.
> idebus=
— This can be any number from 20 to 66; autodetection is attempted, but this can set it manually if dmesg
says that it isn't autodetected correctly or if you have it set in the BIOS to a different value (overclocked). Most PCI controllers are happy with 33
.
> pci=biosirq
— Some motherboards might cause Linux to generate an error message saying that you should use this. Look in dmesg
for it; if you do not see it, you don't need to use it.
These options can be entered into /boot/grub/grub.conf
in the same way as other options are appended.
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
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.
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.
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
.
File System Tuning
Never content to leave things alone, Linux provides several tools to adjust and customize the file system settings. The belief is that hardware manufacturers and distribution creators tend to select conservative settings that will work well all the time, leaving some of the potential of your system leashed — that's why you have chosen
The Linux file system designers have done an excellent job of selecting default values used for file system creation and the 2.6 version of the Linux kernel now contains new code for the IDE subsystem that significantly improves
sync
Because Linux uses buffers when writing to devices, the write does not occur until the buffer is full, until the kernel tells it to, or if you tell it to by using the sync
command. Traditionally, the command is given twice, as in the following:
# sync ; sync