Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

Speeding up disk access on Linux

are you running with the handbrake on?

12:01 am on Aug 4, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 17, 2002
votes: 6

I was looking at different sites to get some tips on speeding up the Linux (debian) 1Ghz PIII server I have. I came across some interesting stuff.

You can tweak Apache, optimize your php et al, but the bottom line is your hardware. I found that my disks were running at a slow, safe speed, which is stupid. It's like driving your car with the handbrake on, cos thats safer.

I've collated what I've found from other places and here's the answer - how to make your disks run 2x 4x 8x faster.

You nay have a 100Mb EIDE bus, you may have disks with transfer speeds of 20-30 or 40MB/s. But if you have taken the default safe install, your'e disks are running like slugs. You need to issue a few commands to tune it up.

First: disclaimer. Do the following at your own risk. Take backups before changes.

log in as root and type:

hdparm -Tt /dev/hda

You should see stuff like:

Timing buffer-cache reads: 128 MB in 1.40 seconds =100.43 MB/sec
Timing buffered disk reads: 64 MB in 14.32 seconds = 4.77 MB/sec

This means that your disk is running at 100MB/sec from its cache, but only 4.77 MB/s from its internal gubbins. So much for yer IBM 33 MB/s transfer rate eh?

Now enter:

hdparm /dev/hda

this shows stuff like:

multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 2866/255/63, sectors = 40043440, start = 0

This means that yer disks are crap. They are running in 16 bit mode and stuff. They are definately running with the handbrake on and the trunk full of lead.

Type this to speed up:

hdparm -c3 -m16 /dev/hda

now do a

hdparm -Tt /dev/hda

and you'll see at least an instant doubling of the transfer rate.

let's try out some superwhizzo settings:

hdparm -X34 -d1 -u1 /dev/hda

Now run the benchmark and see how much speed ya got now.

12:20 am on Aug 4, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 10, 2001
votes: 10

And don't forget to run a backup before you play around with stuff like that... ;)
1:57 am on Aug 4, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Mar 14, 2002
votes: 0

And for extra safety that should be done in single-user mode ('boot: linux single' at the LILO prompt, runlevel 1)
2:58 am on Aug 5, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 28, 2001
votes: 0

Hmm. I am not sure about Debian, but the Linux distribution I use (Mandrake) automatically detected the IDE DMA and use it. No fiddling with hdparm for me... :)

There is more hard drive tuning than just hdparm. For example, the choice of the file system can be important too, like using XFS for high throughput download stuff and ReiserFS for lots of small files in a directory...

7:31 am on Aug 5, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Mar 14, 2002
votes: 0

The autodetection is a kernel issue, and the latest kernels (2.4) have DMA mode by default, while older versions had it disabled.

Even when the DMA mode is automatically set, you would like to check the I/O mode to be set at 32bit; my system has DMA on automatically, but the I/O mode stays at 0 (16bit).


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members