Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams

Hard Disks

After installing Debian on Bach (115.29) a serious performance hit was noticed every time the disks were busy. With the use of hdparm the hard disk parameters could be set. We ensure the parameters were set on each reboot by adding them to /etc/hdparm.conf.

Running hdparm with /dev/hda showed the current parameters:

  # hdparm /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     = 7297/255/63, sectors = 117231408, start = 0
   busstate     =  1 (on)

To test the current performance of a disk use the -Tt option:

  # hdparm -Tt /dev/hda

   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

For Bach (115.29) the problem was fixed by turning on DMA (-d1), 16 multiple sectors (-m16), and 32 bit I/O support (-c1):

  # hdparm -d1 -m16 -c1 /dev/hda

The performance was then quite a bit better:

  # hdparm -Tt /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

To get extra information about a disk drive use:

  # hdparm -i /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

Be careful in changing the parameters of your disks 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 (115.29) an additional IDE controller (a CMD680 from Silicon Image) with 2 ST360021A disks was installed. These disks were identical to the disk on the PIIX4 IDE controller, but setting the parameter -d1 resulted in a hung shell on a test with -Tt.

To ensure new settings are saved for each reboot add the appropriate device entry to /etc/hdparm.conf.

Here are some timings for a number of disks -- these have not needed hdparm tuning with current kernels:
Host Disk Cached Read Buff Read
Athene (115.13) WD1600JS 1299.55 MB/sec 57.13 MB/sec
Belinos (115.11) MX 6Y160M0 1877.35 MB/sec 55.55 MB/sec
Belinos (115.11) ST3250823AS 1882.40 MB/sec 66.30 MB/sec

Also see http://linux.oreillynet.com/pub/a/linux/2000/06/29/hdparm.html for further introductory explanations.

Copyright © 1995-2014 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.