From:
[email protected]
This one time, at band camp, J�rg Sommer said:
begin Stephen Gran schrieb am Sun 08. Aug, 18:20 (-0400) :
Yes, the test -e is exactly the problem. test -e rootfs is not true,
so $ROOT_FS remains unset.
Well, this is a mistake. I toke the assumtion a root fs is ever existing.
But on the other hand, this cause is caught by "case $ROOT_DEV in *)"
Reading from /proc/mounts gives a broken answer, and so there's 2
choices:
hdparm does not run on the root fs before it is mounted, or
hdparm runs on all drives twice.
No. I would prever the old way, that all is run early at boot time.
Agreed, however there is a third way - I realize. Read from the output
of mount(1), instead of /proc/mounts. This gives accurate information
about what is mounted where, in a very compatible way.
I also am uneasy about the the end user running
/etc/init.d/hdparm start, and not having all their drives processed -
not that they should be doing this frequently, but it seems
counterintuitive otherwise.
I think the last script I sent does the following:
If run as /etc/rcS/S06hdparm.first, it only runs on the root disk, but
reads from mount, rather than /proc
If run as /etc/rcS/S29hdparm, it does the rest of your disks, skipping
the root disk
If run as /etc/init.d/hdparm, it runs on all disks.
Also includes new parser code to allow people to put straight hdparm
lines in hdparm.conf in the following format:
command_line {
hdparm (options) /dev/hda
}
Which I think is a nice addition.
I would appreciate it if you could take a look at my revision and see if
it meets your needs and works as expected.
Please can you send me a "sh -x" run of the attached scripted with your config?
Below. Note that there is no config - this is just a test run to see
the parsing for $ROOT_DIR. Below that is a sample run after my
revision.
steve@gashuffer:~$ cat /proc/mounts > /tmp/mounts
steve@gashuffer:~$ sudo sh -x ./hdparm start
+ set -e
+ case $1 in
+ grep -w -q nohdparm /proc/cmdline
+ raidstat=OK
+ '[' -e /proc/mdstat ']'
+ '[' -e /proc/rd/status ']'
+ '[' OK = OK ']'
+ read dev dir junk
+ '[' -e rootfs -a / = / ']'
+ read dev dir junk
+ '[' -e /dev2/root2 -a / = / ']'
+ read dev dir junk
+ '[' -e proc -a /proc = / ']'
+ read dev dir junk
+ '[' -e sysfs -a /sys = / ']'
+ read dev dir junk
+ '[' -e devpts -a /dev/pts = / ']'
+ read dev dir junk
+ '[' -e tmpfs -a /dev/shm = / ']'
+ read dev dir junk
+ '[' -e /dev/hda3 -a /usr = / ']'
+ read dev dir junk
+ '[' -e /dev/hda5 -a /tmp = / ']'
+ read dev dir junk
+ '[' -e /dev/hda6 -a /var = / ']'
+ read dev dir junk
+ '[' -e /dev/hda7 -a /home = / ']'
+ read dev dir junk
+ '[' -e usbfs -a /proc/bus/usb = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/music -a /home/mp3 = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/movies -a /home/movies = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/backups -a /home/backups = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home -a /usr/share/Server = / ']'
+ read dev dir junk
+ case "$0" in
+ case "$ROOT_DEV" in
+ '[' '' '!=' yes ']'
+ exit 0
steve@gashuffer:~$ ln hdparm hdparm.first
steve@gashuffer:~$ sudo sh -x ./hdparm.first start
+ set -e
+ case $1 in
+ grep -w -q nohdparm /proc/cmdline
+ raidstat=OK
+ '[' -e /proc/mdstat ']'
+ '[' -e /proc/rd/status ']'
+ '[' OK = OK ']'
+ read dev dir junk
+ '[' -e rootfs -a / = / ']'
+ read dev dir junk
+ '[' -e /dev2/root2 -a / = / ']'
+ read dev dir junk
+ '[' -e proc -a /proc = / ']'
+ read dev dir junk
+ '[' -e sysfs -a /sys = / ']'
+ read dev dir junk
+ '[' -e devpts -a /dev/pts = / ']'
+ read dev dir junk
+ '[' -e tmpfs -a /dev/shm = / ']'
+ read dev dir junk
+ '[' -e /dev/hda3 -a /usr = / ']'
+ read dev dir junk
+ '[' -e /dev/hda5 -a /tmp = / ']'
+ read dev dir junk
+ '[' -e /dev/hda6 -a /var = / ']'
+ read dev dir junk
+ '[' -e /dev/hda7 -a /home = / ']'
+ read dev dir junk
+ '[' -e usbfs -a /proc/bus/usb = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/music -a /home/mp3 = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/movies -a /home/movies = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home/backups -a /home/backups = / ']'
+ read dev dir junk
+ '[' -e 192.168.0.1:/home -a /usr/share/Server = / ']'
+ read dev dir junk
+ case "$0" in
+ BEFORE_ROOT_FSCK=yes
+ case "$ROOT_DEV" in
+ '[' yes '!=' yes ']'
+ echo 'Warning: Could not find disk device of root partition; running hdparm on all'
Warning: Could not find disk device of root partition; running hdparm on all
+ ROOT_DEV=
+ echo -n 'Setting disc parameters:'
Setting disc parameters:+ DISC=
+ DEFAULT=
+ OPTIONS=
+ DEF_QUIET=
+ OPT_QUIET=
+ /bin/sync
+ egrep -v '^[[:space:]]*(#|$)' /tmp/hdparm.conf
+ read KEY SEP VALUE
grep: /tmp/hdparm.conf: No such file or directory
+ printf '\b.\n'
.
+ exit 0
steve@gashuffer:~$ sh -x /etc/rcS.d/S07hdparm.first start
+ set -e
+ case $1 in
+ grep -w -q nohdparm /proc/cmdline
+ raidstat=OK
+ '[' -e /proc/mdstat ']'
+ '[' -e /proc/rd/status ']'
+ '[' OK = OK ']'
++ /bin/mount
++ find_root_dev
++ read dev on dir junk
++ '[' -e /dev/hda1 -a / = / ']'
+++ readlink --canonicalize /dev/hda1
++ ROOT_DEV=/dev/hda1
++ echo /dev/hda1
++ break
+ ROOT_DEV=/dev/hda1
+ case $0 in
+ BEFORE_ROOT_FSCK=yes
+ case $ROOT_DEV in
+ ROOT_DEV=/dev/hda
+ echo -n 'Setting disc parameters:'
Setting disc parameters:+ DISC=
+ DEFAULT=
+ OPTIONS=
+ DEF_QUIET=
+ OPT_QUIET=
+ /bin/sync
[continued in next message]
--- SoupGate-Win32 v1.05
* Origin: you cannot sedate... all the things you hate (1:229/2)