Saturday, February 27, 2010

Boosting Western Digital Advanced Format drive performance in Linux

Once again, a little hdparm trickery seems to be the trick to getting the WD Caviar Green “EARS” series to perform as expected.

From the hdparm man page:

-m

Get/set sector count for multiple sector I/O on the drive. A setting of 0 disables this feature. Multiple sector mode (aka IDE Block Mode), is a feature of most modern IDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather than the usual one sector per interrupt. When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput of anywhere from 5% to 50%. Some drives, however (most notably the WD Caviar series), seem to run slower with multiple mode enabled. Your mileage may vary. Most drives support the minimum settings of 2, 4, 8, or 16 (sectors). Larger settings may also be possible, depending on the drive. A setting of 16 or 32 seems optimal on many systems. Western Digital recommends lower settings of 4 to 8 on many of their drives, due tiny (32kB) drive buffers and non-optimized buffering algorithms. The -i flag can be used to find the maximum setting supported by an installed drive (look for MaxMultSect in the output). Some drives claim to support multiple mode, but lose data at some settings. Under rare circumstances, such failures can result in massive filesystem corruption.

The WD10EARS has a MaxMultSect value of 16.

$ hdparm -i /dev/sdc

/dev/sdc:

 Model=WDC WD10EARS-00Y5B1, FwRev=80.00A80, SerialNo=WD-WMAV51402824
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

$ hdparm -m /dev/sdc

/dev/sdc:
multcount = 0 (off)
$ hdparm -m 16 /dev/sdc

/dev/sdc:
setting multcount to 16
Use of -m is VERY DANGEROUS.
Only the old IDE drivers work correctly with -m with kernels up to at least 2.6.29.
libata drives may fail and get hung if you set this flag.
Please supply the --yes-i-know-what-i-am-doing flag if you really want this.
Program aborted.
$ hdparm --yes-i-know-what-i-am-doing -m 16 /dev/sdc

/dev/sdc:
setting multcount to 16
multcount = 16 (on)

Before “-m 16”: 40-50MB/s writes
After “-m 16”: 90MB/s writes

Now that's more like it.

0 comments:

Tags

linux (4) software (4) hardware (3) musings (3) osmium (3) projects (3) science (1) typography (1)