Improving Hard Drive Performance - tuning with hdparm...

Note: You will need to be logged in as root to perform this tweak.

Default Settings:

#/sbin/hdparm -t /dev/hda

/dev/hda:
 Timing buffered disk reads:  64 MB in  3.57 seconds = 17.93 MB/sec

Identification info that was obtained from the drive at boot time:

#/sbin/hdparm -i /dev/hda
 
/dev/hda:
 
 Model=Maxtor 4D040H2, FwRev=DAH017K0, SerialNo=D21ZWSPE
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=4047/16/255, CurSects=-217054981, LBA=yes, LBAsects=80043264
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes: pio0 pio1 pio2 pio3 pio4
 DMA modes: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5
 AdvancedPM=yes: disabled (255)
 Drive Supports : ATA/ATAPI-6 T13 1410D revision 0 : ATA-1 ATA-2 ATA-3 ATA-4 ATA-5 ATA-6

See the current settings:

#hdparm -v /dev/hda
 
/dev/hda:
 multcount    = 16 (on)
 I/O support  =  0 (16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 nowerr       =  0 (off)
 readonly     =  0 (off)
 readahead    =  8 (on)
 geometry     = 4982/255/63, sectors = 80043264, start = 0

Notice that I/O support is 16-bit, but doing research on the "Maxtor 4D040H2", I found that it support 32-bit. Also, unmaskirq is turned off and DMA mode is set to: udma2 (X66). The "MaxMultiSect" is the number to use for the multicount setting.

Changing to new settings:
Turning on 32-bit mode, udma5 (X69), umask and dma for "/dev/hda".

#/sbin/hdparm -c1 -X69 -u1 -d1 /dev/hda

Final result of the tweak:

#/sbin/hdparm -t /dev/hda
 
/dev/hda:
 Timing buffered disk reads:  64 MB in  2.08 seconds = 30.77 MB/sec

Notice the considerable improvement!!

Tweaked settings:

#/sbin/hdparm -v /dev/hda

/dev/hda:
multcount = 16 (on)
I/O support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 4982/255/63, sectors = 80043264, start = 0

Make sure to `man hdparm` and do a bit of research on your hard-drive before tweaking it and use the above example at your own risk.

Also, refer to this thread for More DETAILS...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Further hdparm tweak info...

My current setting is now:

#/sbin/hdparm -c1 -X69 -u1 -d1 -m16 -A1 -a64 /dev/hda

Notes:

  • -d1 -- Enables DMA
  • -m16 -- Sets the number of sectors to use for IDE block mode (multicount)
  • -A1 -- Enables the auto-readahead feature of the drive
  • -a64 -- tells the drive how far to read ahead.
  • -u1 -- Enables unmasking of interrupts. Greatly improves performance. Can cause problems with certain IDE chipsets on certain 2.0.x kernels.

To enable UDMA, you use -Xxx where xx is the transfer mode.
Here's how it stacks up:
-X64 : UDMA 0 (ATA 16)
-X65 : UDMA 1 (ATA 25)
-X66 : UDMA 2 (ATA 33)
-X67 : UDMA 3 (ATA 44)
-X68 : UDMA 4 (ATA 66)
-X69 : UDMA 5 (ATA 100)
-X70 : UDMA 6 (ATA 133)

Comment