[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

hdparm script



Hi,

I have a preliminary hdparm init.d script and a config file (hdparm.conf). 
I wasn't able to find a better way of parsing hdparm.conf without an extra C 
program or script, so it only supports hda - hdd. Shall I write an extra 
program to get around the limitation of four devices or is there a better way?
There is a similar situation for networking. The networking init.d script 
uses ifup/ifdown, which wraps up ifconfig. I could write a program, lets say 
"idetune" which wraps hdparm.


regards,
Marc



Here is hdparm.conf (/etc/hdparm.conf)
---------------------------------------------

# Configuration file for /etc/init.d/hdparm.
# Tunes hard drives on boot up.
#
# Syntax:
#[DRIVE]="<hdparm's parameters>"#
#
# Example:
# HDA="-c1 -d1 -m16"
# this turns 32Bit-I/O and DMA for /dev/hda on and sets
# multi sector count to 16.
#
# Currently only hda, hdb, hdc, hdd are supported
# To add support for additional devices change /etc/init.d/hdparm

HDA=""
HDB=""
HDC=""
HDD=""

---------------------------------------------




Here is the hdparm boot script (/etc/init.d/hdparm)
------------------------------------------------

#!/bin/sh
#
# Tunes hard drives on boot up.
# Uses /etc/hdparm.conf.
#
#

# check if config file exists
if [ ! -f /etc/hdparm.conf ]; then
	echo "Drives not tuned. Edit /etc/hdparm.conf to tune drives."
	exit 1
fi

# check if hdparm exists
if [ ! -x /sbin/hdparm ]; then
	echo "hdparm not installed."
	exit 1
fi

#read configuration
HDPARM_CONF=/etc/hdparm.conf
. $HDPARM_CONF


if [ -n "$HDA" ]; then
/sbin/hdparm $HDA /dev/hda
fi

if [ -n "$HDB" ]; then
/sbin/hdparm $HDB /dev/hdb
fi

if [ -n "$HDC" ]; then
/sbin/hdparm $HDC /dev/hdc
fi

if [ -n "$HDD" ]; then
/sbin/hdparm $HDD /dev/hdd
fi

-------------------------------------------------



Reply to: