Crates.io | hddfancontrol |
lib.rs | hddfancontrol |
version | |
source | src |
created_at | 2024-10-21 20:22:41.215231 |
updated_at | 2024-12-12 14:19:00.557275 |
description | Daemon to regulate fan speed according to hard drive temperature on Linux |
homepage | |
repository | https://github.com/desbma/hddfancontrol |
max_upload_size | |
id | 1417900 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This tool has been rewritten in Rust. The previous Python version is in the v1 branch. See Migrating from v1.x for migration.
HDD Fan control is a command line tool to dynamically control fan speed according to hard drive temperature on Linux.
This has 3 benefits:
Because fans will slow down or stop when not needed:
HDD Fan control is useful when you have one or several hard drives with one or several fans close to them, and do not want to let the motherboard control the fan speed, because it does so either statically, or using a temperature sensor unrelated to the real drive temperature (either on the CPU or on some other place on the motherboard).
The ideal use case is for a NAS with several hard drives, a low power CPU (ie. ARM or Intel Atom) with passive cooling (no fans), and a chassis with fans close to the hard drive. It that case the CPU will generate less heat than the hard drives and it makes sense to control fan speed according to the main heat source.
hddtemp
invocationhddtemp
daemon queryhdparm
invocationsmartctl
invocation (SCT)smartctl
invocation (SMART attributes)drivetemp
native kernel hwmonMost motherboards and SATA drives fit these requirements.
* There has been reports of hddfancontrol
working well with SAS drives, however this has not been thoroughly tested.
Some Linux distributions have a hddfancontrol package available in their repository:
See GitHub releases for other packages/binaries built for each tagged version.
You need a Rust build environment for example from rustup.
Run in the current repository:
cargo build --release
install -Dm 755 -t /usr/local/bin target/release/hddfancontrol
or from crates.io
:
sudo cargo install --root /usr/local
Also install hdparm, smartctl and optionally hddtemp.
On recent Ubuntu and other Debian derivatives: sudo apt-get install hdparm smartmontools
.
See systemd service to easily manage the daemon.
The default parameters will run fans at 100% speed at temperatures > 50°C, and run them a 20% speed if < 30°C, which corresponds to the usual recommended drive operating temperature. If you are sure that there are no other components in your system that generate significant heat, if you have other fans to cool down your system, or if you have a case optimized for passive cooling, you can set minimum speed to 0%, which will stop the fans if temperature is below the minimum threshold.
Be aware that a misconfiguration of this tool can lead to a failure to cool down your system properly which can damage components or reduce their lifetime.
Before using HDD Fan control unmonitored for long period of time, I recommend keeping a minimum fan speed for security, and checking that the temperature of your system stays in reasonable range as expected.
To get the start/stop values for the --pwm
parameter, you can either:
pwm-test
command (hddfancontrol pwm-test ...
), which will run some tests and detect the values at which the fans start and stop. However you need to have previously identified the PWM file (the --pwm
parameter)With version 2, hddfancontrol
has been completely rewritten in the Rust language. The main changes coming from version 1 are:
hddfancontrol
is a compiled binary, and does not require a Python interpreter anymore.hddfancontrol
invocations, or in the /etc/conf.d/hddfancontrol
file if you use it through the systemd service. See hddfancontrol daemon -h
for a reference.hddfancontrol
.Run hddfancontrol -h
to get full command line reference.
As an example, the command line below will instruct HDD Fan control to:
/dev/sda
and /dev/sdb
/sys/class/hwmon/hwmon1/device/
hddfancontrol daemon -d /dev/sda /dev/sdb -p /sys/class/hwmon/hwmon1/device/pwm2:200:75 /sys/class/hwmon/hwmon1/device/pwm3:200:75 --min-fan-speed-prct 10 -i 1min
A systemd service file is provided to control the daemon easily. If you installed hddfancontrol from a distribution package, you likely already have it installed, otherwise you can install it from the sources of this repository with:
sudo install -Dm 644 ./systemd/hddfancontrol.service /etc/systemd/system/hddfancontrol.service
sudo install -Dm 644 ./systemd/hddfancontrol.conf /etc/conf.d/hddfancontrol
Then you need to edit the HDDFANCONTROL_DAEMON_ARGS
variable in /etc/conf.d/hddfancontrol
to set the parameters (drives, temperature range...).
You can then start the daemon with sudo systemctl start hddfancontrol
, see its status with sudo systemctl status hddfancontrol
and enable automatic startup at boot time with sudo systemctl enable hddfancontrol
.