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



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Disk Performance

Various parameters of a hard disk can be set using hdparm. This is required sometimes when you notice your system becoming sluggish everytime the hard disks are accessed (see Section 21.3.1). The same process can help with access to CDs and DVDs when, for example, you find that watching a DVD is very choppy (stop-and-start) (see Section 21.1.1).

After installing Debian on bach ([*]) 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

  /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

  /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 (36.42) 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

  /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
  /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 (36.42) 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 (36.26) WD1600JS 1299.55 MB/sec 57.13 MB/sec
Belinos (36.24) MX 6Y160M0 1877.35 MB/sec 55.55 MB/sec
Belinos (36.24) 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.


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.