-
OK so i tryied Rumen Code but i get :
Code:
# ./hdd-stop.sh
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
"ctrl+c"
[admin@RouterASSUS root]$
what is wrong ?
PS i switched hdd disk name from sdd to sda. and i saw running mc that i do not have an /date directory on /opt/bin.
-
but one more question wpte ... on .10 firmware existed path /dev/scsi/host0/bus0/target0/lun0/disc
now in this build with what is replaced ?
because /dev/sda is not an SCSI block device, so on this build where is the scsi block device ??
10x
-
Hey tmsulica ,
so you have one HDD (sda)?
Try this one.
1.Check the paths/location of your programs
/opt/bin/sdparm
/opt/bin/sync
/opt/bin/sg_start
etc..
are they correct for you??
2.Did you install sdparm and sg3-utils??
3.Put this line in /opt/etc/crontab:
*/10 * * * * admin /opt/whatever-you-want/that_script
It will check fo activity every 10 min.
4.Are the commands worked for you by himself????
sdparm --flexible --command=stop /dev/sda &>/dev/null
sdparm --flexible --command=sync /dev/sda &>/dev/null
sg_start 0 --pc=2 /dev/sda
awk '/sda/ {print $12}' /proc/diskstats
etc.....
But even if you succeed , the disk will not remain down , because firmware need to access it.(log , swap ... etc)!!!
Even cron need to read that script from HDD!!!
So spin up again ->> spin down --> spin up --> spin down.
And that is for VERY short periond.
As you know HDD don`t like spin up/donw too much.
You have to install /opt on the flash stick and use HDD only for storage.
#!/bin/bash
DISKNAME=sda
a=0
#check 70 times with 0.1s gaps,
#and go on adding
for i in `seq 0 70`
do
b=`awk '/$DISKNAME/ {print $12}' /proc/diskstats`
a=`expr $a + $b`
sleep 0.1s
done
echo $a
if [ $a == 0 ]
then
echo "$DISKNAME No Activity-->>spindown" >> /opt/var/log/syslog.log
/opt/bin/sync
/opt/bin/sdparm --flexible --command=sync /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sdparm --flexible --command=stop /dev/$DISKNAME &>/dev/null
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start --stop /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=2 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
/opt/bin/sg_start 0 --pc=3 /dev/$DISKNAME
else
echo "$DISKNAME Active-->wait ....." >> /opt/var/log/syslog.log
fi
exit 0
Regards
Rumen