NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
dishmagic66
Apr 26, 2014Guide
How to control fanspeed on a RN104
On special request, here is a workaround for controling the fanspeed of the RN104 ( most likely the same on a 102).
For this you will have to SSH in to the NAS.
Thanks to Moseleypj for doing the work.
First you create a file in /root with the name fanoveride. Put the following lines in to the file.
Now chmod 755 /root/fanoveride
===================
Now create a file in /etc/init.d with the name fanoveride.
Put the following lines in to this script
Now make sure it is executable and starts on boot:
To control it manually:
In my case i have the min and max temp in the script set to 35 and 75 degrees to create a nice fan response wich is not to nervous.
If you set it between 40 and 65 the regulating becomes more agressive.
Just play with the values for your needs.
For this you will have to SSH in to the NAS.
Thanks to Moseleypj for doing the work.
First you create a file in /root with the name fanoveride. Put the following lines in to the file.
#!/bin/bash
## Variables ##
FANPWMPATH=/sys/devices/platform/mv64xxx_i2c.0/i2c-0/0-003e/pwm1
FANSPEEDPATH=/sys/devices/platform/mv64xxx_i2c.0/i2c-0/0-003e/fan1_input
CORETEMPPATH=/sys/devices/platform/axp-temp.0/temp1_input
MAXFAN=100 # Maximum operable speed
MINFAN=0 # Minimum operable speed
MINPWM=75 # PWM Limit
MAXPWM=255 # PWM Limit
MINTEMP=35 # Min temp -> Fan slowest
MAXTEMP=75 # Max temp -> Fan fastest
NEWSPEED=50 # Initial fan speed (%)
## Functions ##
function getReadings {
FANPWM=$(cat $FANPWMPATH)
FANSPEED=$(cat $FANSPEEDPATH)
CORETEMP=$(cat $CORETEMPPATH)
}
function setFanSpeed {
if [ $NEWSPEED -lt $MINFAN ]; then
NEWSPEED=$MINFAN
fi
if [ $NEWSPEED -gt $MAXFAN ]; then
NEWSPEED=$MAXFAN
fi
NEWPWM=$(expr $MAXPWM - $MINPWM)
NEWPWM=$(expr $NEWPWM \* $NEWSPEED)
NEWPWM=$(expr $NEWPWM / 100)
NEWPWM=$(expr $NEWPWM + $MINPWM)
echo $NEWPWM > /sys/devices/platform/mv64xxx_i2c.0/i2c-0/0-003e/pwm1
}
function calcFanPercent {
TEMPRAN=$(expr $MAXTEMP - $MINTEMP)
TEMPREL=$(expr $CORETEMP - $MINTEMP)
TEMPREL=$(expr $TEMPREL \* 100)
TEMPPER=$(expr $TEMPREL / $TEMPRAN)
NEWSPEED=$TEMPPER
}
###################################################################
echo "Automatically controlling fan speed..."
while true
do
getReadings
echo "Temp: $CORETEMP C FAN: $NEWSPEED% [$FANSPEED RPM] [$FANPWM]"
calcFanPercent
setFanSpeed
sleep 10
done
###################################################################
Now chmod 755 /root/fanoveride
===================
Now create a file in /etc/init.d with the name fanoveride.
Put the following lines in to this script
#!/bin/sh
### BEGIN INIT INFO
# Provides: FanOveride
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: FanOveride overides the default ReadyNAS fan control
### END INIT INFO
SCRIPT=~/fanoveride
RUNAS=root
PIDFILE=/var/run/fanoveride.pid
LOGFILE=/var/log/fanoveride.log
start() {
if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then
echo 'Service already running' >&2
return 1
fi
echo 'Starting service.' >&2
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
su -c "$CMD" $RUNAS > "$PIDFILE"
echo 'Service started' >&2
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
echo 'Service not running' >&2
return 1
fi
echo 'Stopping service.' >&2
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
echo 'Service stopped' >&2
}
uninstall() {
echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
local SURE
read SURE
if [ "$SURE" = "yes" ]; then
stop
rm -f "$PIDFILE"
echo "Notice: log file is not be removed: '$LOGFILE'" >&2
update-rc.d -f <NAME> remove
rm -fv "$0"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
uninstall)
uninstall
;;
retart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|uninstall}"
esac
Now make sure it is executable and starts on boot:
chmod +755 /etc/init.d/fanoveride
update-rc.d fanoveride defaults
To control it manually:
service fanoveride start
service fanoveride stop
In my case i have the min and max temp in the script set to 35 and 75 degrees to create a nice fan response wich is not to nervous.
If you set it between 40 and 65 the regulating becomes more agressive.
Just play with the values for your needs.
90 Replies
Replies have been turned off for this discussion
- Hi all,
I recently setup my new 314 and attempted to use this script but it doesn't seem to be working. The fan stays 730-780 rpm with temps as follows:
Fan - 750RPM
CPU - 53
system - 39
Disk 1 - 43
Disk 2 - 41
Disk 3 - 45
Disk 4 - 48
This is without any activity at all, just the disks spinning, not in a volume.
I'm wondering if anyone has implemented this successfully on a 314 because i'm not getting any errors and the service seems to be starting.
I've also tried changing the min and max temp to 40 and 60 respectively but still no change.
any help much appreciated - Hi All,
Not sure if anyone is interested but I had a look at the logs for this from my 314 and it's now obvious to me why it's not working but not so obvious as to the fix. If anyone is interested in getting more info, reply to the thread.
Automatically controlling fan speed...
cat: /sys/devices/platform/mv64xxx_i2c.0/i2c-0/0-003e/pwm1: No such file or directory
cat: /sys/devices/platform/mv64xxx_i2c.0/i2c-0/0-003e/fan1_input: No such file or directory
cat: /sys/devices/platform/axp-temp.0/temp1_input: No such file or directory
Temp: C FAN: 50% [ RPM] []
expr: syntax error
expr: syntax error
expr: syntax error
/root/fanoveride: line 21: [: -lt: unary operator expected
/root/fanoveride: line 24: [: -gt: unary operator expected
expr: syntax error
expr: syntax error - hawke84Tutorhow possible is it to build this into an app with GUI?
- I don't know what permissions you can run the ReadyNAS apps under, whether they would be sufficient for this sort of thing.
I'm a total linux newbie so I really don't know. I just got this to work through trial and error and my limited programming knowledge. - ARayAspirantI've been going around on the second script, and can't quite get this working. If I see this, what am I doing wrong now..?
insserv: Script fanoveride is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: warning: script 'leafp2p' missing LSB tags and overrides - ARayAspirantI figured out that when I copied the script into notepad++ or vi, it was giving extra spaces at the beginning of each line. After I took those out, I now get no errors, and it says the service is started, but fan still shows as hanging out at 800 RPM. Any suggestions on where to look when it looks like it should be "on"?
I had been on 6.3.3-T153 beta, so I went back to 6.2.2 to see if the beta was an issue and that put my fan speeds in the 680s range... - tiff_leeTutorHi all hopefully someone can help me out here, trying to use this guide in order to get some 'better' fan control on my RN104 but struggling a little bit, SSH and linux commands are all new to me.
Created the two files as per the first post (using notepad++ but what file format am I supposed to save them in, .sh? or are they not meant to have a file extension at all) and put them in the appropriate location using Bitvise SFTP.
Once i've changed the properties value to 755 and run the "update-rc.d fanoveride defaults" I receive an error "insserv: warning: script 'leafp2p' missing LSB tags and overrides" ?
I appear to be missing something here and it will probably be obvious to the more experienced people out there, pointers appreciated.
Lee - booboo59ApprenticeThank you note to the OP, the scripts work well on my RN104. Only change would be that the +755 needs to be just 755. Other than that, the instructions are spot on!
- tiff_leeTutorNo one can explain this error?
root@Lee-NAS:/etc/init.d# chmod 755 /etc/init.d/fanoveride
root@Lee-NAS:/etc/init.d# update-rc.d fanoveride defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'leafp2p' missing LSB tags and overrides - Thanks for this! I got this running in less than 2 minutes and my cpu is down to 50 and the disk to 39 (deg c). Not sure if the startup option is working and I've heard a few reports that it's not but to be honest I'm running this machine all the time... thanks again
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!