From: Andrew Tridgell (
Subject: tip of the day (hdparm tuning)

This tip is useful for just about any Linux box, and is probably the simplest way to significantly speed up your IDE based Linux box without changing the hardware.

If you are impatient then just add the following near the top of your /etc/rc.d/rc.sysinit (or equivalent startup script):

/sbin/hdparm -u 1 -d 1 /dev/hda
/sbin/hdparm -u 1 -d 1 /dev/hdc

(and so on for any IDE devices in your system)

Now for a more complete explanation.

By default Linux uses extremely conservative settings for IDE. In particular the default settings do two things that make IDE perform really badly:

1) DMA is not used. That means all data coming to/from the hard disk or cdrom is processed a byte at a time by the CPU. That is not very efficient. With a fast processor that isn't doing anything else at the time this can appear fast in simple minded benchmarks but it is a big drain on CPU resources when you are actively using the machine.

2) hardware interrupts are masked during IDE transfers. That means that while a lump of data is being transferred to/from a IDE device no other interrupts are processed. This includes interrupts from other IDE devices, from network devices, from serial ports and from mice. Your whole machine is effectively clagged up doing nothing but waiting for a horrendously slow device to say "I'm done". Not good.

If you want to see just how slow this is on your system then do the following:

1) put a CDROM in the drive.

2) run the following commands:

hdparm -d 0 -u 0 /dev/hda
hdparm -d 0 -u 0 /dev/hdc
cat /dev/hdc > /dev/null &
hdparm -t /dev/hda
hdparm -d 1 -u 1 /dev/hda
hdparm -d 1 -u 1 /dev/hdc
hdparm -t /dev/hda

that shows you the hard disk speed while accessing the CDROM with the default settings and with the improved settings. On my system the hard disk speed goes from 3.8 MB/sec to 12.9 MB/sec. I've seen much bigger changes on some other systems.

Even more importantly than the speedups is the fact that you will stop dropping your PPP connection while doing cdrom transfers, and you will be able to use your system while burning a cdrom without creating a coaster.

You may wonder why the default settings are so poor. The reason is that there is some rare hardware out there that corrupts data during IDE transfers when you either use DMA or receive an interrupt during a transfer. If that happens then the kernel should detect the failure (in nearly every case) and fall back to the default settings. Unfortunately after the auto-fallback you are still left with corrupt data in your cache. Luckily systems that don't handle DMA and unmasked interrupts are really quite rare these days so it is a pretty safe bet to turn the options I suggested above, especially if your system isn't from the stone age.

For more info and piles of options for fine tuning your IDE system try "man hdparm".

Cheers, Tridge