[Guide] Asustor fan control


Recommended Posts

This is a remake of a guide on how to control ASUStor NAS fans in unraid. The prior thread was cluttered with some unrelated support information, and the methodology on how to do this best is now significantly changed. 

 

Step 1 : Install the asustor platform drivers from Community Applications. Reboot.

 

At this point plugins such as Dynamix temp and autofan will now work. HOWEVER : Note that most Asustor NAS boxes only have one fan. The Dynamix autofan plugin will control fan speed based on DRIVE TEMPS.  But it will not control the fan for CPU TEMP. 

 

To control fan temps based on CPU temps, I created the script below. 

 

Step 2 : Install the User scripts plugin. 

Step 3 : Add the below script, with a custom schedule of  * * * * *   (every minute)

 

Update the fan curves to your preference.  

 

Trouble shooting : 

 

If the script doesn't work, run "sensors" in a terminal window and look at the top section with CPU temperatures.  The "CPU Temp" text in the HIGHEST_TEMP line may need to be updated. It may say "Package 0" or something else. 

 

Also, in a terminal window, run "ls -lQ /sys/class/hwmon | grep -i it87 | cut -d "\"" -f 2"  and update the ARRAY_FAN value to the correct hwmon value

 

#!/bin/bash
#!/bin/bash

    TEMPS=(0 70 75 80)
    SPEEDS=(90 130 170 255)
    
    # Fan device. Depends on your system. pwmconfig can help with finding this out. 
    # pwm1 is usually the cpu fan. You can "cat /sys/class/hwmon/hwmon0/device/fan1_input"
    # or fan2_input and so on to see the current rpm of the fan. If 0 then fan is off or 
    # there is no fan connected or motherboard can't read rpm of fan.
    ARRAY_FAN=/sys/class/hwmon/hwmon1/pwm1
    
    
    #REPLACE HD TEMP WITH CPU TEMP FROM SENSORS
    HIGHEST_TEMP=$(/usr/bin/sensors | grep "CPU Temp" | cut -d"+" -f2 | cut -c1-2)
    
    
    for i in ${!TEMPS[@]}; do 
        CHECKTEMP=${TEMPS[$i]}                
        #echo "loop " $i $CHECKTEMP
        if [ "$HIGHEST_TEMP" -le "$CHECKTEMP" ]; then
            break
        fi
        LASTTEMP=${TEMPS[$i]}
        FANSET=${SPEEDS[$i]}
    done
    echo "Temp " $HIGHEST_TEMP " >= " $LASTTEMP "Setting fan to " $FANSET
    echo $FANSET > $ARRAY_FAN

 

 

Link to comment

@Terebi I have the Asustor AS6704T and even though the Dynamix System Autofan control lists my NVMe drives, it appears to only control fan speeds with the HDDs temps. This isn't ideal when you have the HDDs spin down. I've set the minimum pwm value to 114 to keep the fan running at little under 1200 rpm. However, I think I may expand on your script a bit more and look at CPU, HDD, and NVMe drives with temperature ranges for each and run the fan at the highest required setting in the future. If I get time to work on it, I'll post it.

Link to comment
17 hours ago, KO-RAM2023 said:

@Terebi I have the Asustor AS6704T and even though the Dynamix System Autofan control lists my NVMe drives, it appears to only control fan speeds with the HDDs temps. This isn't ideal when you have the HDDs spin down. I've set the minimum pwm value to 114 to keep the fan running at little under 1200 rpm. However, I think I may expand on your script a bit more and look at CPU, HDD, and NVMe drives with temperature ranges for each and run the fan at the highest required setting in the future. If I get time to work on it, I'll post it.

 

In my box, the drive temps are never high enough to worry about running the fan because of the drives, so I didn't go down this path. 

 

My script was actually based off of a script that did fan control based off of drive temps.  I believe this is the script I based it off of (you can see some of the comments are the same). However, the next link  points to another fan speed script which apparently auto-discovers hard drives. One or both of these scripts may accelerate your work.   

 

One enhancement I had made over the original script was to allow for many "curve" points instead of just low/med/high. 

https://github.com/kmwoley/unRAID-Tools/blob/master/unraid_array_fan.sh

 

https://forums.unraid.net/applications/core/interface/file/attachment.php?id=9069

 

 

Edited by Terebi
Link to comment

In my AS6704T, I have two 16TB IronWolf Pros and two 1TB WD Red NVMes running in Raid 1 cache.  The NVMe drives will get thermo warnings within 5 minutes if I don't at least have the fan running at 750 rpm.  I think the links you sent should help me add the NVMe drives in without too much effort. I was using your script (with a few changes) before last week, but when I put the new AsustorPFD plugin on, I thought I'd give the Dynamix control a try. It works "OK" by setting the minimum PWM speed to keep the fan running at low speed, but it's not ideal. When the HDDs spin up it works OK, but I try to keep them spun down as much as possible. The 1TB cache setup does a nice job and keeping them off. Thanks for the links @Terebi I'll post when I get it done.

Link to comment
5 minutes ago, KO-RAM2023 said:

In my AS6704T, I have two 16TB IronWolf Pros and two 1TB WD Red NVMes running in Raid 1 cache.  The NVMe drives will get thermo warnings within 5 minutes if I don't at least have the fan running at 750 rpm.  I think the links you sent should help me add the NVMe drives in without too much effort. I was using your script (with a few changes) before last week, but when I put the new AsustorPFD plugin on, I thought I'd give the Dynamix control a try. It works "OK" by setting the minimum PWM speed to keep the fan running at low speed, but it's not ideal. When the HDDs spin up it works OK, but I try to keep them spun down as much as possible. The 1TB cache setup does a nice job and keeping them off. Thanks for the links @Terebi I'll post when I get it done.

 

The default fan speed seems to be 850 for me, and I keep it at like 1200 even when things are cool,  in my script   since thats below where I can hear it most of the time. 

 

I think the trick with drive temps will be checking the temp without spinning them up. (or rather not checking the temp of a spun down drive).  But I guess if you list only the NVMEs it won't matter. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.