February 19, 20242 yr 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
February 19, 20242 yr Author reserved @KO-RAM2023 @ich777 @bk0043 I'm going to delete the old post and move to this one since the instructions changed so much, and that prior thread was also cluttered with my personal unrelated unraid stability issue.
February 19, 20242 yr @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.
February 20, 20242 yr Author 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 February 20, 20242 yr by Terebi
February 20, 20242 yr 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.
February 20, 20242 yr Author 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.
August 29, 20241 yr I just wanted to say thank you and also add my script so maybe someone can find it when they're searching for fan control for the Asustor AS5402T 😎 I added more temps and speeds as 90 was really high for the fans pwm speeds and had the fan spinning at 1912 rpm. I changed the ARRAY_FAN to match the correct pwm path #!/bin/bash TEMPS=(0 55 60 65 70 75 80) SPEEDS=(45 60 75 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/devices/platform/asustor_it87.2608/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
June 5, 20251 yr Thanks for this topic! i had the same issue on an AS5402T.However, i used the bash at this page as inspiration and created my own script with linear scaling for the fan speed#!/bin/bash# Define temperature range for smooth scalingTEMP_MIN=40 # Minimum temperature (fan runs at lowest speed)TEMP_MAX=80 # Maximum temperature (fan runs at highest speed)# Define fan speed rangeSPEED_MIN=45 # Minimum fan speed (PWM value)SPEED_MAX=255 # Maximum fan speed# hwmon pathHWMON_PATH=/sys/devices/platform/asustor_it87.2608/hwmon/hwmon1/pwm1# Validate PWM control pathif [[ ! -f "$HWMON_PATH" ]]; then echo "Error: PWM fan control device not found!" exit 1fi# Fetch CPU temperature with improved extractionCPU_TEMP_RAW=$(/usr/bin/sensors | grep -E "CPU Temp|Package id 0" | awk '{print $3}' | tr -d '+°C')# Validate temperature readingif [[ -z "$CPU_TEMP_RAW" ]]; then echo "Error: Unable to read CPU temperature!" exit 1fi# Convert temperature to integerCPU_TEMP=$(printf "%.0f" "$CPU_TEMP_RAW")# Ensure temperature stays within boundsif (( CPU_TEMP < TEMP_MIN )); then FANSET=$SPEED_MINelif (( CPU_TEMP > TEMP_MAX )); then FANSET=$SPEED_MAXelse # Linearly interpolate fan speed FANSET=$(( SPEED_MIN + (CPU_TEMP - TEMP_MIN) * (SPEED_MAX - SPEED_MIN) / (TEMP_MAX - TEMP_MIN) ))fi# Log temperature and fan speedecho "CPU Temp: $CPU_TEMP°C → Adjusting fan speed to: $FANSET"# Ensure PWM control is enabledPWM_ENABLE_PATH="${HWMON_PATH}_enable"if [[ -f "$PWM_ENABLE_PATH" ]]; then echo 1 > "$PWM_ENABLE_PATH"fi# Apply fan speed adjustmentecho "$FANSET" > "$HWMON_PATH"New to this forum, unsure how to use the code block.. Edited June 5, 20251 yr by Krisyv3
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.