Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [125]

By Root 1419 0
that make excellent complementary material to the disk I/O-specific information that I will provide in this section.

Tuning ATA Disks with hdparm

Written by Mark Lord, hdparm allows administrators to change low-level hard disk settings. Unfortunately, hdparm is really useful only for tuning ATA disks. (While hdparm can conduct a few operations on SCSI disks, most of those operations are purely informational.) SCSI users are left with quite a void in terms of low-level disk tweaking, compared with the number of features that hdparm can adjust. (Zealous proponents of SCSI would surely argue, of course, that SCSI needs no tuning because of its superiority!)

hdparm is usually found at /sbin/hdparm. Because of the low-level hardware changes it can make, you must be root to use it. It's a good idea to make certain the most recent version is installed on your system. If you need to upgrade (version 5.2 is the most recent version, as of this writing), or if hdparm wasn't included as part of your distribution, you can download it at http://www.ibiblio.org/pub/Linux/system/hardware/ or download a package from your distributor. Debian users may be able to run apt-get install hdparm, but as of this writing, the stable version is not the most recent.

With a device as its only argument, hdparm returns information about a hard disk's current settings:

# hdparm /dev/hda

/dev/hda:

multcount = 16 (on)

I/O support = 0 (default 16-bit)

unmaskirq = 0 (off)

using_dma = 1 (on)

keepsettings = 0 (off)

nowerr = 0 (off)

readonly = 0 (off)

readahead = 8 (on)

geometry = 2434/255/63, sectors = 39102336, start = 0

busstate = 1 (on)

The hdparm command can also be combined with the -i option to display identification information about the hard disk, as well as a list of its alleged capabilities. I use the word "alleged" because hdparm -i isn't always 100 percent accurate. Using the -i parameter is a feature supported only by disks that are relatively new (built within the last few years), so using it on older disk will have varied results.

# hdparm -i /dev/hda

/dev/hda:

Model=ST320414A, FwRev=3.05, SerialNo=3EC0V5EG

Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }

RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0

BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16

CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=39102336

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

Some of the tweaks I'm going to outline here can cause problems that include data corruption. Some of these problems may not necessarily be immediately noticeable. I advise testing thoroughly any changes you implement before moving your system into production. I'll point out some particulars and point you to additional information whenever it's available.

Enabling DMA mode transfers

All ATA disks transfer data using one of two modes: Programmed I/O (PIO) or Direct Memory Access (DMA). You'll notice in the hdparm -i output above that there are PIO and DMA lines, each with a list of more specific transfer modes. PIO support is deprecated at this point because it is much slower than even the original incarnations of DMA. There are also a few different iterations of DMA: single-word, multi-word, and ultra. (Multi-word DMA is also commonly referred to as bus-mastering.)

UltraDMA is the most modern and fastest implementation. On the DMA mode line in the last code example, there are three multi-word DMA modes and six UltraDMA modes listed. udma2, udma4, and udma5 correspond to the common UltraATA/33, UltraATA/66, and UltraATA/100 transfer speeds that I outlined in Chapter 2 (see also Table 7-2, below).

Table 7-2. hdparm -X values

Name

Speed (MB/s)

Value (-X#)

pio0

3.3

8

pio1

5.2

9

pio2

8.3

10

pio3

11.1

11

pio4

16.7

12

mdma0

4.2

32

mdma1

13.3

33

mdma2

16.7

34

udma0

Return Main Page Previous Page Next Page

®Online Book Reader