Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
etc
 
 
 
 
 
 
 
 

README.md

storagefancontrol

Fan speed PID controller based on hard drive temperature

This script is meant for storage servers with lots of (spinning) hard drives. It regulates the chassis (PWM) fan speed based on the hard drive temperature.

The script is intended for people who build large storage servers used in an environment (at home) where noise matters.

The hard drive temperature is monitored through either SMART or the MegaCLI tool used by LSI-based HBA controllers.

Fan speed is governed by PWM fan controls and sensors as supported by Linux under /sys/class/hwmon, such as /sys/class/hwmon/hwmon2/device/pwm2.

This script has been updated to handle multiple PWM devices.

Fan control is coverned by the control loop feedback mechanism PID. Here is a nice intro on PID. By using PID, the script always finds the optimal fan speed no matter what the circumstances are.

For example, if you have 24 drives in a chassis, this script checks the temperature of each drive. The temperature of the hottest drive is used to determine if the chassis fans need to run faster, slower or if they should stay at the same speed.

the PID controller makes sure that an optimal fan speed is found to keep the system at a maximum of - in my case - 40C.

The script logs internal variables to syslog by default.

Temp: 40 | FAN: 51% | PWM: 130 | P=0   | I=51  | D=0   | Err=0  |
Temp: 40 | FAN: 51% | PWM: 130 | P=0   | I=51  | D=0   | Err=0  |
Temp: 40 | FAN: 51% | PWM: 130 | P=0   | I=51  | D=0   | Err=0  |
Temp: 40 | FAN: 51% | PWM: 130 | P=0   | I=51  | D=0   | Err=0  |
Temp: 39 | FAN: 43% | PWM: 109 | P=-2  | I=50  | D=-5  | Err=-1 |
Temp: 39 | FAN: 47% | PWM: 119 | P=-2  | I=49  | D=0   | Err=-1 |
Temp: 40 | FAN: 54% | PWM: 137 | P=0   | I=49  | D=5   | Err=0  |
Temp: 40 | FAN: 49% | PWM: 124 | P=0   | I=49  | D=0   | Err=0  |
Temp: 40 | FAN: 49% | PWM: 124 | P=0   | I=49  | D=0   | Err=0  |
Temp: 40 | FAN: 49% | PWM: 124 | P=0   | I=49  | D=0   | Err=0  |

This will give you output on the console:

export DEBUG=True 

The disk temperature is read through 'smartctl' (part of smartmontools). Temperature can also be read through LSI-based HBAs managed by MegaCLI. You must edit the main function to switch between these two options.

The script performs a poll every 30 seconds by default.

I'm using this script myself to govern the fan speed of my [storage server][NAS].

NAS: http://louwrentius.com/71-tib-diy-nas-based-on-zfs-on-linux.html

INSTALL

  1. Copy the configuration file in /etc/
  2. Copy the executable in /usr/sbin
  3. Make sure the script is executed on boot. If you use systemd, put the etc/systemd/system/storagefancontrol.service file in the same path on your system. Run systemctl restart storagefancontrol to start the daemon.

Graphite

If you want to send metrics to graphite:

  1. pip3 install graphitesend (to install the graphitesend module)
  2. edit your config file section [Graphite] with the appropriate settings.

About

Sets chassis fan speed based on highest disk temperature

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.