Background
Most Linux distributions choose safe IDE interface configurations for
default installations. This allows for successful installs, but does
not always result in optimal disk performance. The notes below discuss
the steps necessary to optimize your disk I/O. The information was gathered
from a variety of web pages, man pages, kernel source code, and Computer Organization
text books.
Disk I/O Options
Modern IDE drives have several options available to them, depending on the
options available on the motherboard. The most important ones include:
- Multi-block transport
- Data width transport to the IDE interface.
- Direct Memory Access (DMA)
- Disk read ahead
- OS read ahead
- IRQ unmasking
Software Requirements
The following software needs to be installed.
- Use the debian package
hdparm.bash# apt-get install hdparm
- Special kernel support may be required for DMA. Download
the latest CIT kernel build.
Editbash# wget /it/it3110/sources/linux-2.4.29-dsccit-y05m03d02.tgz bash# tar zxf linux-2.4.29-dsccit-y05m03d02.tgz bash# cd linux-2.4.29-dsccit-y05m03d02 bash# ./unpack-kern.bash
/etc/lilo.confto add the new kernel image as an option.
Install the new configuration, and reboot to the new image.image=/boot/bzImage-2.4.29-dsccit-y05m03d02 label=y05m03d02 read-onlybash# lilo bash# lilo -R y05m03d02 bash# reboot
Kernel Driver Installation
Without the correct IDE driver, DMA will not be available.
- Determine the IDE Interface chipset.
Outputs may include VIA or Intel based chipsets.bash# grep 'IDE interface' /proc/pci
- Use
modconfto install the driver for your chipset. The drivers are located underkernel/drivers/ide/pci. - VIA chipsets use
via82cxxx. - Intel chipsets use
piix.
Drive Configuration
- Test the speed of the drive.
bash# hdparm -tT /dev/hda
- Determine drive capabilities.
bash# hdparm -v /dev/hda /dev/hda: Model=Maxtor 6E040L0, FwRev=NAR61590, SerialNo=E1KG4BKE Config={ Fixed } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=80293248 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 *udma6 AdvancedPM=yes: disabled (255) WriteCache=enabled Drive Supports : ataATA-1 ATA-2 ATA-3 ATA-4 ATA-5 ATA-6 ATA-7 - Configure multi-block transport. The 16 comes from
MaxMultSectabove.bash# hdparm -m 16 /dev/hda /dev/hda: setting multcount to 16 multcount = 16 (on)
- Configure for wider bus transfers. The 1 is not completely safe. There are a
few older chipsets that will cause data loss. If you have one of those, then use
3. (Read the man page for hdparm).
bash# hdparm -c1 /dev/hda /dev/hda: setting 32-bit I/O support flag to 1 I/O support = 1 (32-bit)
- Enable Direct Memory Access (DMA)
bash# hdparm -d1 /dev/hda /dev/hda: setting using_dma to 1 (on) using_dma = 1 (on)
- Best DMA mode. The 70 comes from 64 + 6. 64 is because we are using
UltraDMA (udma) from the output of hdparm -v. 6 is because we are using
version 6 (udma6) of UltraDMA.
bash# hdparm -X70 /dev/hda /dev/hda: setting xfermode to 70 (UltraDMA mode6)
- Disk read ahead
bash# hdparm -A 1 /dev/hda /dev/hda: setting drive read-lookahead to 1 (on)
- OS read ahead
bash# hdparm -a 8 /dev/hda /dev/hda: setting fs readahead to 8 readahead = 8 (on)
- IRQ unmasking
bash# hdparm -u 1 /dev/hda /dev/hda: setting unmaskirq to 1 (on) unmaskirq = 1 (on)
- Test the speed of the drive.
bash# hdparm -tT /dev/hda
Make it permanent
In order to make the changes permanent accross system reboots, install
a startup script to reconfigure the drive at boot time.
- Create a simple shell script with the
hdparmconfiguration command.#!/bin/bash hdparm -u 1 -c 1 -d 1 -A 1 -a 8 -m 16 /dev/hda
- Put the script in
/etc/init.d/hdparm - Make a link to the script from
/etc/rcS.d/S21hdparm
|
The new kernel version needs to be made permanent. Edit
/etc/lilo.conf and change the default to the new
kernel.
|
|



