× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

How to control fanspeed on a RN104 for 6.7.4

darkone
Guide

How to control fanspeed on a RN104 for 6.7.4

Updating an old script to control the fan speed on the newer Firmware. I am not claiming credit all i did was update the sys path for the new frimware and change the startup script that had a typo 

 

originally came from post https://community.netgear.com/t5/New-to-ReadyNAS/How-to-control-fanspeed-on-a-RN104/td-p/911970

 

1. First you create a file in /root with the name fanoverride.sh. Put the following lines in to the file.

nano /root/fanoverride.sh
#!/bin/bash

## Variables ##
FANPWMPATH=/sys/devices/platform/soc/soc:internal-regs/d0011000.i2c/i2c-0/0-003e/hwmon/hwmon0/fan1_target
FANSPEEDPATH=/sys/devices/platform/soc/soc:internal-regs/d0011000.i2c/i2c-0/0-003e/hwmon/hwmon0/fan1_input
CORETEMPPATH=/sys/devices/virtual/thermal/thermal_zone0/temp

MAXFAN=3500   # Maximum operable speed
MINFAN=700     # Minimum operable speed

MINTEMP=35000 #35 C
MAXTEMP=70000 #70 C
NEWSPEED=1000  # Initial fan speed (%)

## Functions ##
function getReadings {
        FANPWM=$(cat $FANPWMPATH)
        FANSPEED=$(cat $FANSPEEDPATH)
        CORETEMP=$(cat $CORETEMPPATH)
        }

function setFanSpeed {

        TEMPFAN=$(expr $MAXFAN - $MINFAN)
        NEWFAN=$(expr $TEMPFAN \* $NEWSPEED)
        NEWFAN=$(expr $NEWFAN / 100)
        NEWFAN=$(expr $NEWFAN + $MINFAN)
        if [ $NEWFAN -lt $MINFAN ]; then
                NEWFAN=$MINFAN
                fi
        if [ $NEWFAN -gt $MAXFAN ]; then
                NEWFAN=$MAXFAN
                fi

        echo New Speed: $NEWFAN RPM

        echo $NEWFAN > $FANPWMPATH
        }

function calcFanPercent {
        TEMPRAN=$(expr $MAXTEMP - $MINTEMP)
        TEMPREL=$(expr $CORETEMP - $MINTEMP)
        TEMPREL=$(expr $TEMPREL \* 100)
        TEMPPER=$(expr $TEMPREL / $TEMPRAN)
        NEWSPEED=$TEMPPER
        echo New Speed Set: $NEWSPEED % at $(date +%T)
        }


###################################################################
echo "Automatically controlling fan speed..."
while true
        do
                getReadings
                echo "Temp: $CORETEMP C FAN: $NEWSPEED% [$FANSPEED RPM] [PWM $FANPWM]"

                calcFanPercent
                setFanSpeed

                sleep 5
        done
###################################################################

2. Now chmod 755 /root/fanoverride.sh

chmod 755 /root/fanoverride.sh

3. Now create a file in /etc/init.d with the name fanoveride.

nano /etc/init.d/fanoverride
#!/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=/root/fanoverride.sh
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
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|uninstall}"
esac

4. Now make sure it is executable

chmod +755 /etc/init.d/fanoverride

5. Make it start at boot or start it manually

#auto start with system
update-rc.d fanoverride defaults
#manually
service fanoverride start
service fanoverride stop

Use at you own risk and its not my fault if you break your NAS or burn your house down Smiley Happy.

 

Post if you have questions

Model: RN10200|ReadyNAS 100 Series 2-Bay (Diskless),RN10400|ReadyNAS 100 Series 4-Bay (Diskless)
Message 1 of 10
mdgm-ntgr
NETGEAR Employee Retired

Re: How to control fanspeed on a RN104 for 6.7.4

Not sure why you'd want to use this with the range of in-built fan control options available now.

Message 2 of 10
darkone
Guide

Re: How to control fanspeed on a RN104 for 6.7.4

Well the build in method thur the GUI even on the cool setting doesn't seem to keep the NAS cool at all max i have seen 800-1000 RPMs. With CPU temp at 60 C. At least with this script you can get temps down to 50 C and HD temp will be lower as well. 

 

I feel Netgear needs a better calc for fan speed or at least more control to the user. aka thermal limits based on temps like QNAP and almost every other vendor

 

Also i do feel like this script should only be used by people that really know what they are doing. Since it is basicly a hack job and will most likely break when 6.8 or later rolls out

Message 3 of 10
Retired_Member
Not applicable

Re: How to control fanspeed on a RN104 for 6.7.4

When my rn104 gets challenged its fan goes up to 3k+ rpm. That keeps the cpu below 60C and the 4 HGSTs in the 40s.

This is good enough for my purposes, because it is getting difficult to ignore the noise created by this level of cooling.

 

 

I never saw the fan going beyond 4k rpm and do not look forward to experiencing that. I imagine to hear such a level of noise, which could hardly be ignored in a living room.

 

I'm always using cooling option "balanced" and sometimes set that to "cool", if any kind of "purgatory" is in sight. 

Message 4 of 10
AndreasK123
Guide

Re: How to control fanspeed on a RN104 for 6.7.4

I live in Singapore and the auto fan control setting still don't keep the disks at acceptable temps, so this is useful. I don't want to wait until the disk hit 50+ degress for the fan to ramp up

Message 5 of 10
AndreasK123
Guide

Re: How to control fanspeed on a RN104 for 6.7.4

I'm getting 'Failed to start fanoverride.service: Unit fanoverride.service not found.'

any pointers?

Message 6 of 10
michtu
Tutor

Re: How to control fanspeed on a RN104 for 6.7.4

But, why don't install fancotrol from Debian repo? 

https://packages.debian.org/jessie/fancontrol

Message 7 of 10
darkone
Guide

Re: How to control fanspeed on a RN104 for 6.7.4

Idk Never tried it on an ARM based system. I guess it would work if 104 uses a Lm-sensors to control the fan. My guess it might mess up the frontend gui. but idk 

 

Have you used it? and if so any issues?

Message 8 of 10
michtu
Tutor

Re: How to control fanspeed on a RN104 for 6.7.4

You can have right.

I don't test it - I have different model 😉

But fancontrol has tool for generation config and it can detect sensors on the motherboard.

Message 9 of 10
AndreasK123
Guide

Re: How to control fanspeed on a RN104 for 6.7.4

i'm willing to give this a go on my 314. just worried that it won't detect the sensors properly

Message 10 of 10
Top Contributors
Discussion stats
  • 9 replies
  • 5197 views
  • 3 kudos
  • 5 in conversation
Announcements