NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

dishmagic66's avatar
Apr 26, 2014

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.
    #!/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
  • I not have any help now im wait again... I want folder and help for Fw 6.4.0 and readynas 104 too
  • The temperature value is Degrees C * 1000

    So MAXTEMP there is configured to 62.5C
  • Hello

     

    Tested on 6.4.2 (RN102). Does not seem to have any effect. The service starts writing the temperature and speed of the fan in the logs but no effect on the fan

     

     

    Thanks

  • Hi!

    I am new to linux  and my ReadyNAS DUO FAN i is very loud and I want to try to adjust the fan speed. The built in calibration of the temperature fan do not work.

    Can I use this script on a RND2000V1. It has an Infrant SPARC CPU, RADIator 4.1.15?

     

    Thanks in advance

    Thomas

    • StephenB's avatar
      StephenB
      Guru - Experienced User

      Per_thomasl wrote:


      I am new to linux  and my ReadyNAS DUO FAN i is very loud and I want to try to adjust the fan speed... Can I use this script on a RND2000V1. It has an Infrant SPARC CPU, RADIator 4.1.15?

       

       

      4.1.15 is very different from OS 6, so I think the answer is no.  There is an add-on which lets you set the minimum RPM, but that won't affect the max, so I don't think it will help you.

       

      What disk temperatures are you seeing?  Do you think the fan is failing?

      • Per_thomasl's avatar
        Per_thomasl
        Aspirant

        The disk temp is very low 28-30 °C and still the fan is running att high speed :(

NETGEAR Academy

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

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More