GNU/Linux Desktop Survival Guide by Graham Williams |
|||||
After installing Debian on Bach (97.17) a serious performance hit was noticed every time the disks were busy. With the use of hdparm the hard disk parameters could be set and with hwtools we could ensure the parameters were set on each reboot. See Section 97.17 for an example. See also 27.1.
To test your current performance (this one shows results after tuning):
# hdparm -Tt /dev/hda /dev/hda: Timing buffer-cache reads: 128 MB in 0.56 seconds =228.57 MB/sec Timing buffered disk reads: 64 MB in 1.60 seconds = 40.00 MB/sec |
Here's one before tuning:
# hdparm -Tt /dev/hdg /dev/hdg: Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec Timing buffered disk reads: 64 MB in 49.39 seconds = 1.30 MB/sec |
To determine the current settings for a disk drive use:
# hdparm /dev/hda /dev/hda: 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 = 116301/16/63, sectors = 117231408, start = 0 busstate = 1 (on) |
Then to get information about a disk drive use:
# hdparm -i /dev/hda /dev/hda: Model=ST360021A, FwRev=3.19, SerialNo=3HR0VNYY Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117231408 IORDY=on/off, tPIO={min:240,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=no WriteCache=enabled Drive Supports : Reserved : ATA-1 ATA-2 ATA-3 ATA-4 ATA-5 |
Various parameters can be set, such as turning on direct memory access (-d1), 16 multiple sectors (-m16), and 32 bit I/O support (-c1):
# hdparm -d1 -m16 -c1 /dev/hda |
Be careful though as some settings may cause the disk to stop responding! This may require a hard reboot after which the default settings are returned. For example, on Bach an additional IDE controller (a CMD680 from Silicon Image) with 2 ST360021A disks, identical to the disk on the PIIX4 IDE controller, but setting the parameter -d1 hangs the shell on a test with -Tt.
Also see http://linux.oreillynet.com/pub/a/linux/2000/06/29/hdparm.html for further introductory explanations.