"Speed up" Linux with hdparm

Vincent Danen, TechRepublic
31 January 2005 01:05 PM
Tags: disk drive, storage, hdd, hard drive, ide, hda, dev, dma
TechRepublic
These days, most hard drives are of the ATA100 or ATA133 specification. The theoretical transfer rate of an ATA100 drive is 100 MBps; an ATA133 drive's theoretical transfer rate is 133 MBps. Of course, these are theoretical rates.

Many Linux systems use conservative defaults that could be slowing down your system. At the very least, these defaults could be preventing your system from reaching the maximum speeds that your hardware allows.

Like most parts of a Linux system, how Linux interacts with your IDE hard drives is configurable. You can accomplish this using the hdparm tool, which allows you to customise many aspects of any given IDE hard drive device.

Of course, using hdparm requires caution because your drive could end up corrupting data or failing if you configure it incorrectly.

To get the information of your device, execute the following:

hdparm /dev/hda

To get more extended information, use the following:

hdparm -i /dev/hda

Replace /dev/hda with the IDE device name of the drive you wish to report on. (hda is the first drive on the first IDE bus.)

Look for the multcount, IO_support, and using_dma fields. These fields help you determine if your drive is using its full capabilities.

Let's assume that the device in question is an ATA100 or ATA133 drive using an 80-wire cable. To determine the speed of the drive, execute the following:

# hdparm -Tt /dev/hda

/dev/hda:
Timing buffer-cache reads: 968 MB in 2.00 seconds = 484.00 MB/sec
Timing buffered disk reads: 88 MB in 3.05 seconds = 28.85 MB/sec

The results show that the drive is operating at a fairly decent speed. If your drive is an ATA100 or ATA133 drive and you're getting speeds of 1 to 2 MBps, then your drive isn't using DMA mode, which you can tell from the hdparm information noted above. You can also tell this by looking for the using_dma keyword. (It should have a value of 1 for on.)

To tweak the speed, execute the following:

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

This turns on DMA mode, specifies the maximum number of disk sectors to transfer in a single request (older drives should use -m8), and enables 32-bit transfers to the ATA controller. Using hdparm /dev/hda should reveal (among other things) the following lines:

/dev/hda:
multcount = 16 (on)
IO_support = 1 (32-bit)
using_dma = 1 (on)

Some new drives don't enable these settings on their own, so you'll need to use hdparm to achieve the maximum speed your drive will permit.

This tip is from TechRepublic's free Linux NetNote newsletter.

TechRepublic is the online community and information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to firewalls, we offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.

©2005 TechRepublic, Inc.

Advertisement

Talkback 0 comments


Latest Videos

Blogs

  • Renai LeMay Datacentre disaster lessons
    As a system administrator, the health and status of your datacentre is at the forefront of your mind. But how often do you think about the needs beyond server status and bandwidth?
  • Array E-health too unsexy for COAG
    There will always be something more politically sexy than e-health for state governments, meaning the National E-Health Transition Authority's business case for a national electronic medical record might just sit on the shelf gathering dust forever.
  • Array TelstraUnClear
    Telstra's New Zealand arm TelstraClear is one strange company ...
  • More blogs »

Tags

Back to top

Featured