Saturday, September 18, 2010

Speed up Linux Disk I/O

        Although I have limited experience in Linux but my Linux exposure taught me that windows 7  bit edition is faster than Linux.  To contradict my statement one Linux geek in Sydney told me that I should fine tune my disk access parameters  to get the better disk I/O in hard disk. To my surprise he was right. Although I am not sure this issue is there with all hardware and all version of Linux or not but in my case that’s a correct and I corrected it. Now my Linux desktop is as fast as my Windows 7.  

        Many Linux distributions are installed in such a way that the 32-bit input/output (I/O) and DMA capabilities of today's Ultra ATA/66 or SATA  hard drives are not fully exploited. By reconfiguring your system, you can get much better performance.
Here I am  giving few steps which you could use to speed up your had drive
To find out if your hard drive is configured for 16-bit I/O,
1.    switch to superuser,
2.      Type hdparm -c followed by a space and the name of the drive (such as /dev/hdc), and press [Enter].
If yours system OUTPUT Is  following, your system is configured to access this drive in 16-bit mode:

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

Use the following command to test your disk's speed:
  1. hdparm - Tt /dev/hdc                     (substitute your drive's name for /dev/hdc);
System will display data transfer rate (in MB/sec) for buffer cache and buffered disk reads.

To turn on 32-bit I/O and DMA support, follow the steps which I am giving below :
hdparm -c 1 -d 1 /dev/hdc (use your drive's device name):

If the command succeeds, you'll see the message:

setting 32-bit I/O support flag to 1
setting using_dma to 1 (on)
I/O support = 1 (32-bit)
using_dma = 1 (on)

Try the hdparm -Tt /dev/hdc command to see how much improvement you've obtained. If you're happy with the result, repeat this command for additional drives, if any.

To commit the successful settings, use the same command with the -k option, as in the following example:

hdparm -c 1 -d 1 -k 1 /dev/hdc

Because this command is lost when we reboot Linux, we may wish to put this command into a system initialization script, such as /etc/rc.d/rc.local. If you modify this script, be careful that you don't erase any of the existing code!

I am still searching the setting to enable the 64 bit I/O but hot having a 64 bit edition of linux to experiment with. Once I am able to figure out the setting I will update it . But if you are aware please do update me or post it in comment.  

No comments: