Tune your hard disk under Linux

In Linux, (probably similar with other unix-flavour..) /sbin/hdparm is used to tune the hard disk. Although in most cases the hard disks are tuned to offer its maximum throughput, it's a good idea to check the current setting and try to get an even better result.

Warning Unless you are extremely lazy, it's a good idea to see the manpage of the hdparm before playing with it to avoid any potential damages to the hard disk.

1. See the current setting by typing /sbin/hdparm -i /dev/hda

/dev/hda:

             Model=Maxtor 7540 AV, FwRev=GA7X4647, SerialNo=L1007YZS
             Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>5Mbs FmtGapReq }
             RawCHS=1046/16/63, TrkSize=0, SectSize=0, ECCbytes=11
             BuffType=3(DualPortCache), BuffSize=32kB, MaxMultSect=8, MultSect=8
             DblWordIO=yes, maxPIO=2(fast), DMA=yes, maxDMA=1(medium)
             CurCHS=523/32/63, CurSects=379584528, LBA=yes, LBA=yes, LBAsects=1054368
             tDMA={min:150,rec:150}, DMA modes: sword0 sword1 *sword2 *mword0
             IORDY=on/off, tPIO={min:240,w/IORDY:180}, PIO modes: mode3

It will give something like the above.

2. Let's use 32-bit transfer, instead of the default 16-bit


alice# /sbin/hdparm -c3 /dev/hda

This will turn on 32-bit transfer with sync mode, which in my experience results in the best throughput. c0 gives the default mode (normally 16 bit) and c1 gives 16-bit transfer mode, while c2 gives 32-bit without sync.

3. Let's use UltraDMA mode


alice# /sbin/hdparm -d1 -X66 /dev/hda

This will turn on the UltraDMA mode 2 transfer, which is supported by most modern IDE hard disks. If yours is a bit old and does not support UltraDMA, then try


alice# /sbin/hdparm -d1 -X34 /dev/hda

This will enable multiword DMA mode 2 transfer. In rare cases, if your hard disk is really old and the above two don't work, use


alice# /sbin/hdparm -d1 /dev/hda

which will use 16-bit DMA transfer.

4. Every time you change the setting, type


alice# /sbin/hdparm -t /dev/hda

This will check the current throughput of the hard disk so that you can check which setting yields the best performance.

Note: after your have a set of hdparm options, it's a good idea to make a boot script to perform the setting changes, so that you don't have to do it every time you reboot the system. The easiest way to achieve this is to use Webmin.

Legal note: Readers are reminded that the advices from this page are taken at their own risk.

What did I say then?

M&A dearth threatens jobs | FT (3 years 15 weeks ago):

Going, going, going.......

"The pressure for investment banks to continue cutting jobs lo...

Theme provided by Danang Probo Sayekti.