slapNUT
01-01-2002, 01:26 AM
I have some code in my /etc/rc.d/rc.local file to set the hdparm for my two hard drives. I've had this setup for over a year. When I upgrade I just add it to the new rc.local file. Well today I'm snooping through my /etc/rc.d/rc.sysinit and I come across this code.
# Turn on harddisk optimization
# There is only one file /etc/sysconfig/harddisks for all disks
# after installing the hdparm-RPM. If you need different hdparm parameters
# for each of your disks, copy /etc/sysconfig/harddisks to
# /etc/sysconfig/harddiskhda (hdb, hdc...) and modify it.
# each disk witch has no special parameters will use the defaults.
disk[0]=s; disk[1]=hda; disk[2]=hdb; disk[3]=hdc;
disk[4]=hdd; disk[5]=hde; disk[6]=hdf; disk[7]=hdg; disk[8]=hdh;
if [ -x /sbin/hdparm ]; then
for device in 0 1 2 3 4 5 6 7 8; do
unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
. /etc/sysconfig/harddisk${disk[$device]}
HDFLAGS[$device]=
if [ -n "$MULTIPLE_IO" ]; then
HDFLAGS[$device]="-q -m$MULTIPLE_IO"
fi
if [ -n "$USE_DMA" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -d$USE_DMA"
fi
if [ -n "$EIDE_32BIT" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -c$EIDE_32BIT"
fi
if [ -n "$LOOKAHEAD" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -A$LOOKAHEAD"
fi
if [ -n "$EXTRA_PARAMS" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} $EXTRA_PARAMS"
fi
else
HDFLAGS[$device]="${HDFLAGS[0]}"
fi
if [ -e "/proc/ide/${disk[$device]}/media" ] ; then
hdmedia=`cat /proc/ide/${disk[$device]}/media`
if [ "$hdmedia" = "disk" -o "$hdmedia" = "cdrom" ]; then
if [ -n "${HDFLAGS[$device]}" ]; then
action "Setting hard drive parameters for %s: " ${disk[$device]} /sbin/hdparm ${HDFLAGS[$device]} /dev/${disk[$device]}
fi
fi
fi
done
fi
So all I gotta do is edit the file /etc/sysconfig/harddisk and save it as /etc/sysconfig/harddiskhda and /etc/sysconfig/harddiskhdb and I'm all set. Well this is nice but where is the documentation for this. I already checked the Mandrake Documentation and It's not there. I suppose it might be in the Manual but I got my CD's from LinuxCentral and no manual. Anyway I hope maybe somebody else using Mandrake might benifit. Even if you don't use Mandrake you could still put the code in /etc/rc.d/rc.sysinit then all you need is the file /etc/sysconfig/harddisk, I'll post that also in case anyone is interested.
/etc/sysconfig/harddisk
NOTE: You uncomment the parameters you want to enable: Parameters are denoted by lines containing an =.
#USE_DMA=1
# Multiple sector I/O. 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. Under rare circumstances, such failures can result in
# massive filesystem corruption. USE WITH CAUTION AND BACKUP.
# This is the sector count for multiple sector I/O - the "-m" option
#
# MULTIPLE_IO=16
#
#
# (E)IDE 32-bit I/O support (to interface card)
#
# EIDE_32BIT=3
#
#
# Enable drive read-lookahead
#
# LOOKAHEAD=1
#
# Add extra parameters here if wanted
# On reasonably new hardware, you may want to try -X66, -X67 or -X68
# Other flags you might want to experiment with are -u1, -a and -m
# See the hdparm manpage (man hdparm) for details and more options.
#
EXTRA_PARAMS=
<edit> removed the lines in /etc/rc.d/rc.sysinit I hacked because devfs removes my /dev/hdc (cdrom).
[ 01 January 2002: Message edited by: slapNUT ]
# Turn on harddisk optimization
# There is only one file /etc/sysconfig/harddisks for all disks
# after installing the hdparm-RPM. If you need different hdparm parameters
# for each of your disks, copy /etc/sysconfig/harddisks to
# /etc/sysconfig/harddiskhda (hdb, hdc...) and modify it.
# each disk witch has no special parameters will use the defaults.
disk[0]=s; disk[1]=hda; disk[2]=hdb; disk[3]=hdc;
disk[4]=hdd; disk[5]=hde; disk[6]=hdf; disk[7]=hdg; disk[8]=hdh;
if [ -x /sbin/hdparm ]; then
for device in 0 1 2 3 4 5 6 7 8; do
unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
. /etc/sysconfig/harddisk${disk[$device]}
HDFLAGS[$device]=
if [ -n "$MULTIPLE_IO" ]; then
HDFLAGS[$device]="-q -m$MULTIPLE_IO"
fi
if [ -n "$USE_DMA" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -d$USE_DMA"
fi
if [ -n "$EIDE_32BIT" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -c$EIDE_32BIT"
fi
if [ -n "$LOOKAHEAD" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} -q -A$LOOKAHEAD"
fi
if [ -n "$EXTRA_PARAMS" ]; then
HDFLAGS[$device]="${HDFLAGS[$device]} $EXTRA_PARAMS"
fi
else
HDFLAGS[$device]="${HDFLAGS[0]}"
fi
if [ -e "/proc/ide/${disk[$device]}/media" ] ; then
hdmedia=`cat /proc/ide/${disk[$device]}/media`
if [ "$hdmedia" = "disk" -o "$hdmedia" = "cdrom" ]; then
if [ -n "${HDFLAGS[$device]}" ]; then
action "Setting hard drive parameters for %s: " ${disk[$device]} /sbin/hdparm ${HDFLAGS[$device]} /dev/${disk[$device]}
fi
fi
fi
done
fi
So all I gotta do is edit the file /etc/sysconfig/harddisk and save it as /etc/sysconfig/harddiskhda and /etc/sysconfig/harddiskhdb and I'm all set. Well this is nice but where is the documentation for this. I already checked the Mandrake Documentation and It's not there. I suppose it might be in the Manual but I got my CD's from LinuxCentral and no manual. Anyway I hope maybe somebody else using Mandrake might benifit. Even if you don't use Mandrake you could still put the code in /etc/rc.d/rc.sysinit then all you need is the file /etc/sysconfig/harddisk, I'll post that also in case anyone is interested.
/etc/sysconfig/harddisk
NOTE: You uncomment the parameters you want to enable: Parameters are denoted by lines containing an =.
#USE_DMA=1
# Multiple sector I/O. 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. Under rare circumstances, such failures can result in
# massive filesystem corruption. USE WITH CAUTION AND BACKUP.
# This is the sector count for multiple sector I/O - the "-m" option
#
# MULTIPLE_IO=16
#
#
# (E)IDE 32-bit I/O support (to interface card)
#
# EIDE_32BIT=3
#
#
# Enable drive read-lookahead
#
# LOOKAHEAD=1
#
# Add extra parameters here if wanted
# On reasonably new hardware, you may want to try -X66, -X67 or -X68
# Other flags you might want to experiment with are -u1, -a and -m
# See the hdparm manpage (man hdparm) for details and more options.
#
EXTRA_PARAMS=
<edit> removed the lines in /etc/rc.d/rc.sysinit I hacked because devfs removes my /dev/hdc (cdrom).
[ 01 January 2002: Message edited by: slapNUT ]