TrueNas Mini X+ Fan Control

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
Hi everyone,
I own a TrueNas Mini X+ with TrueNas Core 12.

The NAS is way too loud and I would like to slow down the fan to make it more quiet or (even better) reduce the fan speed during a specific time in the day (eg. between 8pm - 8am).
Is it possible? Does the motherboard support tools like ipmitool?
If yes, how can I slow down the fan and/or set up a script to slow down the fan during night periods?

Thanks in advance,
saNeurT
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
This (https://www.ixsystems.com/blog/truenas-mini-x-and-mini-x-plus/) seems to indicate that there's an IPMI onboard...

try ipmitool sensor to see if that's true.

If it is, then you'll need to investigate the right commands for that IPMI to set fan speeds (if it's possible).

If you find the right commands, there are multiple fan scripts in the forums that can ba used/adapted (@Glorious1 , @Stux , @Kevin Horton are the main authors).
Yes, I am able to run ipcmitool in TrueNas.

FAN1 and FAN2 are n/a

FAN3 is:
3700.000 | RPM | ok | 300.000 | 500.000 | 700.000 | 25300.000 | 25400.000 | 25500.000

FANA is:
800.000 | RPM | ok | 200.000 | 300.000 | 500.000 | 25300.000 | 25400.000 | 25500.000
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Looks like a good start...

From @Kevin Horton 's script (https://github.com/khorton/nas_fan_control/blob/master/PID_fan_control.pl, discussed here: https://www.truenas.com/community/threads/pid-fan-controller-perl-script.50908/)

ipmitool raw 0x30 0x70 0x66 0x01 $zone $duty (where $zone is a number representing the FANA or FAN3 header... in the script I think FANA is in zone 1 and should be connected to your case fan(s) and FAN3, together with FAN1&2 are in zone 0. $duty represents a number... in percent that you want the fan to spin where 100 is at full speed)

Here is the helpful comments from the top of that script in case they help

Code:
# The IPMI fan lower and upper fan speed thresholds must be adjusted to be compatible with the fans used.  Do not rely
# completely on manufacturer specs to determine the slowest and fastest possible fan speeds, as some fans have been found
# to run at speeds that differ somewhat from the official specs.  See:
# https://forums.freenas.org/index.php?resources/how-to-change-ipmi-sensor-thresholds-using-ipmitool.35/

# The following ipmitool commands can be run when connected to the FreeNAS server via ssh.  They are useful to set a desired fan duty cycle before
# checking the fan speeds.

# Set duty cycle in Zone 0 to 100%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 100 
# Set duty cycle in Zone 0 to  50%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 50
# Set duty cycle in Zone 0 to  20%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 20

# Set duty cycle in Zone 1 to 100%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 100
# Set duty cycle in Zone 1 to  50%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 50
# Set duty cycle in Zone 1 to  20%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 20

# Check duty cycle in Zone 0:                   ipmitool raw 0x30 0x70 0x66 0x00 0x00
# result is hex, with 64 being 100% duty cycle.  32 is 50% duty cycle.  14 is 20% duty cycle.

#  Check duty cycle in Zone 1:                  ipmitool raw 0x30 0x70 0x66 0x00 0x01
# result is hex, with 64 being 100% duty cycle.  32 is 50% duty cycle.  14 is 20% duty cycle.

# Check fan speeds using: ipmitool sdr


Be careful when setting the fan too slow as you may overheat your components/disks. (using a script like the one linked which reacts to the temperature but can be set to be as low as possible to maintain the temperatures in a safe range is highly recommended)
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
Looks like a good start...

From @Kevin Horton 's script (https://github.com/khorton/nas_fan_control/blob/master/PID_fan_control.pl, discussed here: https://www.truenas.com/community/threads/pid-fan-controller-perl-script.50908/)

ipmitool raw 0x30 0x70 0x66 0x01 $zone $duty (where $zone is a number representing the FANA or FAN3 header... in the script I think FANA is in zone 1 and should be connected to your case fan(s) and FAN3, together with FAN1&2 are in zone 0. $duty represents a number... in percent that you want the fan to spin where 100 is at full speed)

Here is the helpful comments from the top of that script in case they help

Code:
# The IPMI fan lower and upper fan speed thresholds must be adjusted to be compatible with the fans used.  Do not rely
# completely on manufacturer specs to determine the slowest and fastest possible fan speeds, as some fans have been found
# to run at speeds that differ somewhat from the official specs.  See:
# https://forums.freenas.org/index.php?resources/how-to-change-ipmi-sensor-thresholds-using-ipmitool.35/

# The following ipmitool commands can be run when connected to the FreeNAS server via ssh.  They are useful to set a desired fan duty cycle before
# checking the fan speeds.

# Set duty cycle in Zone 0 to 100%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 100
# Set duty cycle in Zone 0 to  50%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 50
# Set duty cycle in Zone 0 to  20%: ipmitool raw 0x30 0x70 0x66 0x01 0x00 20

# Set duty cycle in Zone 1 to 100%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 100
# Set duty cycle in Zone 1 to  50%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 50
# Set duty cycle in Zone 1 to  20%: ipmitool raw 0x30 0x70 0x66 0x01 0x01 20

# Check duty cycle in Zone 0:                   ipmitool raw 0x30 0x70 0x66 0x00 0x00
# result is hex, with 64 being 100% duty cycle.  32 is 50% duty cycle.  14 is 20% duty cycle.

#  Check duty cycle in Zone 1:                  ipmitool raw 0x30 0x70 0x66 0x00 0x01
# result is hex, with 64 being 100% duty cycle.  32 is 50% duty cycle.  14 is 20% duty cycle.

# Check fan speeds using: ipmitool sdr


Be careful when setting the fan too slow as you may overheat your components/disks. (using a script like the one linked which reacts to the temperature but can be set to be as low as possible to maintain the temperatures in a safe range is highly recommended)
Do you think is it safe to use and run the script during boot, as it is published in GitHub?

Should I edit or the default settings are ok?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Do you think is it safe to use and run the script during boot, as it is published in GitHub?

Should I edit or the default settings are ok?
I use a modified version of that script with good results.

For sure you're going to need to adjust at least a few of the parameters though before you start with it.

Were you able to control the fans with the commands as listed in my previous post?

I which case you will be able to run the script (with the right parameters).
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
I use a modified version of that script with good results.

For sure you're going to need to adjust at least a few of the parameters though before you start with it.

Were you able to control the fans with the commands as listed in my previous post?

I which case you will be able to run the script (with the right parameters).
I did not run the listed commands yet, because I'm worried of making mistakes. Now I saved some screenshots about the previous configs (ipmitool sensor's output). Now I try..
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
I was able to change fan speed with the commands (and I realized that the real noise comes from the X5 5400 spinning HDDs)... But I definitely reduced the fan noise...

Now I'm checking CPU and drives temperatures to make sure that with the current setting (20% on both fans), it still enough cool.
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I was able to change fan speed with the commands.
So it's all looking pretty good then.

Have a look through the headers in the script itself (first few hundred lines) and the thread I linked for it and you should be able to work out how to put it into action.

I'm here to clarify anything if needed.
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
So it's all looking pretty good then.

Have a look through the headers in the script itself (first few hundred lines) and the thread I linked for it and you should be able to work out how to put it into action.

I'm here to clarify anything if needed.
I will. Please take a look about me previous message (I edited it).
Do you have any tips to reduce HDDs noise? (Except changing case)
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Do you have any tips to reduce HDDs noise? (Except changing case)
The drives themselves will be some form of limiting factor on what can be done... 7200RPM vs 5400RPM is already a big difference in vibration.

Obviously installing rubber washers where possible will reduce vibration transfer through the case, so can have a big impact.

Tuning the drives under Storage | Disks | Edit (on each disk or en-mass) to change the Acoustic Level (this thread seems to imply that Maximum should mean the quietest... hence maximum noise control... )

20% on both fans sounds very low. You may find that a lot of fans will even stall (stop spinning altogether) below 30%. Also remember that during heavy operations such as a Scrub or SMART test your drives will generate a lot more heat, so what works at idle will certainly not keep temperatures at an acceptable level at load.
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
The drives themselves will be some form of limiting factor on what can be done... 7200RPM vs 5400RPM is already a big difference in vibration.

Obviously installing rubber washers where possible will reduce vibration transfer through the case, so can have a big impact.

Tuning the drives under Storage | Disks | Edit (on each disk or en-mass) to change the Acoustic Level (this thread seems to imply that Maximum should mean the quietest... hence maximum noise control... )

20% on both fans sounds very low. You may find that a lot of fans will even stall (stop spinning altogether) below 30%. Also remember that during heavy operations such as a Scrub or SMART test your drives will generate a lot more heat, so what works at idle will certainly not keep temperatures at an acceptable level at load.
Unfortunately AAM is not available anymore on WD HDDs.
I will look for rubber washers.
Right now I set fans at 30%.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
The reason the fan scripts exist is to crank the fans up when needed, and dial them back down when not. And the issue is that the drive fans have an effect on the CPU temps much of the time... so that's why the two fan zones and the dual cpu/hd fan scripts.

The idea is basically to run the CPU fan as low as necessary at any time, and the HD fans as low as necessary. The key is the "necessary" part a and if you are going to manually configure your fans then you should do some testing with worst-case to ensure that either your CPU or HDs do not get too hot.

I used to use the solnet-array-tester which is a read-only test to stress the HDs, and run mprime on the CPU to stress the CPU. If you can deal with that level of heat, then you're fine. If your CPU temp rises too high, or your HDs get too hot you need to abort the test and looking into a fan script ;)

BUT the good news is it seems you have all the pieces in place to run one of the fan scripts. Probably best to look at @Kevin Horton Hybrid PID script which was adapted from mine by adding PID control (for smooth fan control rather the multi-level bang/bang)

Good luck
 

saNeurT

Dabbler
Joined
Jan 12, 2021
Messages
17
I will test the hybrid PID script asap.

How can I setup this script on boot?
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
i find the best way is to launch it as a tmux session. This prevents it from being killed if middlewared crashes, and also allows you to tmux into it to view its output at anytime. Just remember to disconnect properly (ctrl-b d)

The command to start the script that I use is something like:

tmux new-session -d -s fanscript '/mnt/tank/server/scripts/hybrid_fan_controller.pl'

Screen Shot 2021-10-12 at 3.38.20 pm.png


You can then connect to the "fanscript" session with:

tmux a -t fanscript
 
Top