linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:32:11 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info

Hard Drive Speed Tweak for Linux

Written By: Fancy Piper
fancypiper's note: Check out O'reilly's article on Speeding up Linux Using hdparm

Enabling 32-bit I/O and DMA for the hard drives

See man hdparm for complete details and cautions.

Some Linux distributions aren't optimized for your specific system, so tweaks are necessary. I run RedHat 6.1, and here is how I sped up my disk speed by enabling 32-bit I/O and DMA on my system.

The turning on/off of the 32-bit I/O and DMA has to be done by root with all root privileges. I su - and query my current settings and time the harddrive current performance:

[phil@fancypiper phil]$ su -
Password:

[root@fancypiper /root]# hdparm -c /dev/hda

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


[root@fancypiper /root]# hdparm -c /dev/hdb

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

[root@fancypiper /root]# hdparm -t /dev/hda

/dev/hda:
Timing buffered disk reads: 64 MB in 17.58 seconds = 3.64 MB/sec


[root@fancypiper /root]# hdparm -t /dev/hdb

/dev/hdb:
Timing buffered disk reads: 64 MB in 17.44 seconds = 3.67 MB/sec

Both my drives are set to 16 bit and no DMA. Now, I turn on the 32 bit I/O and DMA and check the timing with the new settings.

[root@fancypiper /root]# hdparm -c 1 -d 1 /dev/hda

/dev/hda:
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)
[root@fancypiper /root]# hdparm -c 1 -d 1 /dev/hdb

/dev/hdb:
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)

[root@fancypiper /root]# hdparm -t /dev/hda

/dev/hda:
Timing buffered disk reads: 64 MB in 11.77 seconds = 5.44 MB/sec


[root@fancypiper /root]# hdparm -t /dev/hdb

/dev/hdb:
Timing buffered disk reads: 64 MB in 5.24 seconds =12.21 MB/sec


[root@fancypiper /root]#

Quite an improvement, especially the second drive!

You can commit these settings by commanding:

[root@fancypiper /root]# hdparm -k 1 /dev/hda

/dev/hda:
setting keep_settings to 1 (on)
keepsettings =  1 (on)
[root@fancypiper /root]# hdparm -k 1 /dev/hdb

/dev/hdb:
setting keep_settings to 1 (on)
keepsettings =  1 (on)

To apply these settings on re-boot, they must be placed in some startup file. Since I use the RedHat 6.1 distro of Linux, I add this to the bottom of my /etc/rc.d/rc.local file.

Here is my /etc/rc.d/rc.local file for an example:


#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

if [ -f /etc/redhat-release ]; then R=$(cat /etc/redhat-release)

arch=$(uname -m) a="a" case "_$arch" in
_a*) a="an";;
_i*) a="an";; esac

NUMPROC=`egrep -c "^cpu[0-9]+" /proc/stat` if [ "$NUMPROC" -gt "1" ]; then SMP="$NUMPROC-processor " if [ "$NUMPROC" = "8" -o "$NUMPROC" = "11" ]; then a="an" else a="a" fi fi

# This will overwrite /etc/issue at every boot. So, make any changes you # want to make to /etc/issue here or you will lose them when you reboot. echo "" > /etc/issue echo "$R" >> /etc/issue echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue

cp -f /etc/issue /etc/issue.net echo >> /etc/issue fi

# Added by phil # This sets 32 bit I/O and DMA for hard drives hdparm -c 1 -d 1 -k 1 /dev/hda

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

Now enjoy your zippier Linux.

fancypiper@crosswinds.net>



We would like to hear your feedback.
[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif