Linux hard drive performance optimization
Posted on 12 September 2008 by Abidoon
Everywhere on the web I read about using the hdparm utility to increase hard drive speed. However it seems that this utility does not support sata drives properly.
I have access to at least 5 different machines that run linux with different sata hard drives but the hdparm command fails more or less on each one of them.
Here is the command I have tried in various places.
hdparm -d1 -c3 -u1 /dev/hda
and I always get errors like
setting 32-bit IO_support flag to 3
HDIO_SET_32BIT failed: Invalid argument
setting unmaskirq to 1 (on)
HDIO_SET_UNMASKINTR failed: Inappropriate ioctl for device
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Inappropriate ioctl for device
IO_support = 0 (default 16-bit)
What I do not understand is that SATA drives have been around for quite some time. So whats the holdup ? Why does this not work?
Tags | hard drive, hdparm, Linux, performance, sata

Errr, there is no holdup. The settings you are trying to change are not used by SATA drives. For example, trying to do -d1 (turn on DMA) is not accepted as SATA do not require this change. (IE: depracated function)
hdparm -v /dev/sda will show your current drive settings.
Typically, about the only thing you can play with is readahead.
So: hdparm -a1024 /dev/sda
This will set read ahead to 1024. (It seems to default to 256 on most Linux distros.) Usually you try 256, 512, 1024, 2048, 4096… as settings. What works for your machine will depend greatly. On one HP Proliant server the onboard SATA controller, this setting changed nothing. But the ADAPTEC RAID controller in the same box went from 95MB/s to 125MB/s going from -a256 to -a2048 which is not a bad jump.
Aha! I see. Thanks a lot. I will try this out today and get back to you.
hdparm -a1024 /dev/sda
worked for me on compaq presario c700 laptop.
Thanks.
If you had to choose between a Seagate, Western Digital, or a Samsung hard drive, which would it be? Which do you consider the most reliable out of them? I had a WD that went to crap on me after about 6 months, so I’m a bit leery of them.