In Debian they have:
/etc/init.d/<startup scripts>
/etc/rc[0-6].d/symlinks
Upon switching to a run level (ie 2, or normal), the system runs all of the symlinks
that start with 'S' in /etc/rc2.d in ALPHABETICAL ORDER with the command 'start'.
looking in that directory you see:
S10syslogd -> ../init.d/syslogd
S12kerneld -> ../init.d/kerneld
S20alsa -> ../init.d/alsa
S99xdm -> ../init.d/xdm
So running alphabetical order
it would execute:
/etc/init.d/syslogd start
/etc/init.d/kerneld start
/etc/init.d/alsa start
/etc/init.d/xdm start
This number is a priority. Do XDM near the end, and syslogd at the beginning. This
is the reason for alphabetical order.
Also in some directories are files that start with K and a number. These are kill
scripts, that are executed when you switch init modes.
so if you execute: 'init 0' (runlevel 0 or halt). it will look for
/etc/rc0.d/K[0-9][0-9]*
K20alsa -> ../init.d/alsa
K90sysklogd -> ../init.d/sysklogd
Execution:
/etc/init.d/alsa stop
/etc/init.d/sysklogd stop
So what I suggest for debian is to make a script that will respond to start/stop. Put
this file in /etc/init.d. Create symlinks for the other directories.
You'd do this:
cd /etc/rc2.d
ln -s ../init.d/hdopt S20hdopt
for i in ../rc[3-5].d ; cp -d S13hdopt $i ; done
for i in ../rc[016].d ; cp -d S13hdopt $i/K13hdopt ; done
This would create your start and kill links to the same script. Changing to run level
0,1,6 turns off the harddrive optimizations. Switching to 2,3,4,5 turns them on.
Using a priority of 13 means it will run after sysklogd and kerneld, but before ppp,
alsa, cron, xdm, etc... but set it to whatever you feel comfortable with. Try it with
'init 1', 'init 4', 'init 0' etc.. (init 0 will halt!)
Here's my script that will start and stop. Modify the hdparm settings for your best
performance.
As a side tip, be sure to read the man page for hdparm. Try all the safe settings,
and test the performance. Have a cpu monitor running as well. It turns out that my
harddrive works fastest and with the least amount of CPU time in 16-bit mode, no
multsect, using only dma. I no longer even use hdparm, because there is now a kernel
option: use dma by default. Turn this on, and the kernel will use dma on boot!
Cory
On Tue, Nov 14, 2000 at 08:16:15PM -0800, Timothy Bolz wrote:
> Q. I want to put hdparm in a local boot file but I don't know where I would
> put in Debian? Debian doesn't have file at least not that I know of. Where
> would I put hdparm to startup when Linux boots?
>
> Tim
#!/bin/sh
# Script created by Cory to turn on of off hdparm harddrive optimizations
case "$1" in
start)
echo "Turning on harddrive optimizations."
/sbin/hdparm -q -m1 -q -d1 /dev/hda
;;
stop)
echo "Turning off harddrive optimizations."
/sbin/hdparm -q -m0 -q -d0 /dev/hda >/dev/null
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/hdopt {start|stop}"
exit 1
esac
exit 0