使用 fan2go 之前,需要确保:
- 系统的 ec 控制器已经正确驱动
- sensors 工作正常
安装 fan2go
按 fan2go 的官方文档,执行以下命令安装 fan2go:
curl -L -o fan2go https://github.com/markusressel/fan2go/releases/latest/download/fan2go-linux-amd64
chmod +x fan2go
sudo cp ./fan2go /usr/bin/fan2go
sudo touch /etc/sensors3.conf
如果下载失败,可以去 fan2go release 页面手动下载。
如果安装过程没有异常,执行命令 fan2go detect
应该能够看到类似于以下内容的输出。
=========== hwmon: ============
> Platform: coretemp-isa-0000
Sensors Index Label Value
1 Package id 0 (temp1_input) 57000
2 Core 0 (temp2_input) 54000
3 Core 1 (temp3_input) 54000
4 Core 2 (temp4_input) 53000
5 Core 3 (temp5_input) 52000
6 Core 4 (temp6_input) 51000
7 Core 5 (temp7_input) 55000
8 Core 6 (temp8_input) 54000
9 Core 8 (temp10_input) 53000
10 Core 9 (temp11_input) 53000
11 Core 10 (temp12_input) 52000
12 Core 11 (temp13_input) 52000
13 Core 12 (temp14_input) 52000
14 Core 13 (temp15_input) 52000
15 Core 14 (temp16_input) 52000
> Platform: drivetemp-scsi-0-40
Sensors Index Label Value
1 hwmon6/temp1 (temp1_input) 38000
> Platform: drivetemp-scsi-0-20
Sensors Index Label Value
1 hwmon4/temp1 (temp1_input) 41000
> Platform: drivetemp-scsi-0-0
Sensors Index Label Value
1 hwmon2/temp1 (temp1_input) 43000
> Platform: nvme-pci-0200
Sensors Index Label Value
1 Composite (temp1_input) 37850
> Platform: nct6779-isa-0a20
Fans Index PWM Channel RPM Channel Label RPM PWM Mode
1 1 1 hwmon7/fan1 0 62 Auto
2 2 2 hwmon7/fan2 1769 161 Manual
3 3 3 hwmon7/fan3 0 255 Disabled
4 4 4 hwmon7/fan4 0 255 Disabled
5 5 5 hwmon7/fan5 0 255 Disabled
Sensors Index Label Value
1 SYSTIN (temp1_input) 118000
2 CPUTIN (temp2_input) 4000
3 AUXTIN0 (temp3_input) 26500
4 AUXTIN1 (temp4_input) 127000
5 AUXTIN2 (temp5_input) 127000
6 AUXTIN3 (temp6_input) 127000
7 PECI Agent 0 (temp7_input) 40500
8 PCH_CHIP_CPU_MAX_TEMP (temp8_input) 0
9 PCH_CHIP_TEMP (temp9_input) 0
10 PCH_CPU_TEMP (temp10_input) 0
11 PCH_MCH_TEMP (temp11_input) 0
12 PCH_DIM0_TEMP (temp12_input) 0
> Platform: drivetemp-scsi-0-30
Sensors Index Label Value
1 hwmon5/temp1 (temp1_input) 41000
> Platform: drivetemp-scsi-0-10
Sensors Index Label Value
1 hwmon3/temp1 (temp1_input) 41000
> Platform: corsaircpro-hid-3-1
Fans Index PWM Channel RPM Channel Label RPM PWM Mode
1 1 1 fan1 4pin 2913 194 N/A
2 2 2 fan2 4pin 2811 194 N/A
3 3 3 fan3 4pin 5690 194 N/A
4 4 4 fan4 4pin 1144 156 N/A
5 5 5 fan5 4pin 2510 161 N/A
6 6 6 fan6 4pin 1078 153 N/A
=========== nvidia: ===========
> Device: nvidia-10DE1380-0300
Name: NVIDIA GeForce GTX 750 Ti
Fans Index Label PWM RPM Mode
1 Fan 1 33 N/A Auto
Sensors Index Label Value
1 GPU 41000
配置 fan2go
将以下内容保存为 fan2go.yaml
保存到 /etc/fan2go/fan2go.yaml
。
dbPath: "/etc/fan2go/fan2go.db"
runFanInitializationInParallel: false
maxRpmDiffForSettledFan: 20
fanResponseDelay: 2
tempSensorPollingRate: 200ms
tempRollingWindowSize: 10
rpmPollingRate: 1s
rpmRollingWindowSize: 10
fanController:
adjustmentTickRate: 200ms
pwmSetDelay: 5ms
# 配置点 1
sensors:
# 配置点 2
curves:
# 配置点 3
fans:
statistics:
enabled: false
port: 9000
api:
enabled: false
host: localhost
port: 9001
profiling:
enabled: false
host: localhost
port: 9002
下面,按“温度传感器”-"风扇转速曲线"-“风扇”的顺序,分别配置上面的 配置点1/2/3
。
根据 CPU 的温度动态控制 CPU 风扇
通常来说,主板厂商在 bios 中预设的温控曲线已经可以满足绝大部分用户的需求, 在系统内动态的控制温度并非必须。
**目标:**CPU 的温度不超过 70 °C,如果超过 70 °C则 CPU 风扇以全速运行。当 CPU 温度低于 40 °C 时,风扇以最小转速运行。
以本机为例,fan2go detect
命令展示 CPU 的温度传感器提供 14 个 CPU 核心的温度(index 2~15)和整个 CPU 的温度(index 1)。
CPU 风扇由主板上的 nct6779-isa-0a20
控制,其位于 index 2 上。
> Platform: coretemp-isa-0000
Sensors Index Label Value
1 Package id 0 (temp1_input) 57000
2 Core 0 (temp2_input) 54000
3 Core 1 (temp3_input) 54000
4 Core 2 (temp4_input) 53000
5 Core 3 (temp5_input) 52000
6 Core 4 (temp6_input) 51000
7 Core 5 (temp7_input) 55000
8 Core 6 (temp8_input) 54000
9 Core 8 (temp10_input) 53000
10 Core 9 (temp11_input) 53000
11 Core 10 (temp12_input) 52000
12 Core 11 (temp13_input) 52000
13 Core 12 (temp14_input) 52000
14 Core 13 (temp15_input) 52000
15 Core 14 (temp16_input) 52000
> Platform: nct6779-isa-0a20
Fans Index PWM Channel RPM Channel Label RPM PWM Mode
2 2 2 hwmon7/fan2 1769 161 Manual
第一步,配置 配置点 1
关于温度传感器的配置。
# 配置点 1
sensors:
- id: cpu_thermal # 该名称可任意定义
hwmon:
platform: coretemp-isa-0000 # 例子输出中 > Platform: coretemp-isa-0000 部分
index: 1
第二步,配置 配置点 2
关于温度曲线的配置。
curves:
- id: cpu_curve # 该名称可任意定义
linear:
sensor: cpu_thermal # 配置点 1 中的 id
min: 35 # 当传感器的温度低于 35 °C 时以最小转速运行
max: 70 # 当传感器的温度高于 70 °C 时以最大转速运行
第三步,配置 配置点 3
风扇的配置。
fans:
- id: cpu # 该名称可任意定义
hwmon:
platform: nct6779-isa-0a20 # 例子输出中 > Platform: nct6779-isa-0a20 部分
rpmChannel: 1
pwmChannel: 1
neverStop: true # CPU 风扇最好设置为永不停止,以避免频繁启停
curve: cpu_curve # 配置点 2 中的 id
完整的配置如下:
dbPath: "/etc/fan2go/fan2go.db"
runFanInitializationInParallel: false
maxRpmDiffForSettledFan: 20
fanResponseDelay: 2
tempSensorPollingRate: 200ms
tempRollingWindowSize: 10
rpmPollingRate: 1s
rpmRollingWindowSize: 10
fanController:
adjustmentTickRate: 200ms
pwmSetDelay: 5ms
# 配置点 1
sensors:
- id: cpu_thermal
hwmon:
platform: coretemp-isa-0000
index: 1
curves:
- id: cpu_curve
linear:
sensor: cpu_thermal
min: 35
max: 70
fans:
- id: cpu
hwmon:
platform: nct6779-isa-0a20
rpmChannel: 1
pwmChannel: 1
neverStop: true
curve: cpu_curve
statistics:
enabled: false
port: 9000
api:
enabled: false
host: localhost
port: 9001
profiling:
enabled: false
host: localhost
port: 9002
使用命令 fan2go config validate
命令可以检查配置文件是否正确,如果提示错误,按提示更改即可。
很多人在配置时,最大的困难是无法确定风扇到底在设备的哪个接口上,可以使用以下方式确认。
这里,还是以上文中配置好的 cpu 风扇为例。执行以下命令(每条命令执行后,间隔数秒钟再执行下一条命令,同时肉眼观察机箱中的风扇的运行状态)。
fan2go fan --id cpu speed 255
fan2go fan --id cpu speed 128
fan2go fan --id cpu speed 0
该命令分别让风扇以满速,半速,最低速(停止)运行,以此确定风扇的配置是否正确。需要注意,一些厂商的 CPU 风扇无法停止运行,即使将数值设置为 0,风扇依旧会以一个非常低的转速运行。
根据硬盘的温度动态控制硬盘风扇
想要读取硬盘的温度,需要挂载 drivetemp
驱动。
以本机为例,本机共挂载了 5 块 3.5 吋的硬盘,它们的显示如下。本机使用 Corsairc Pro 挂载 6个风扇。
**目标:**硬盘的温度不超过 55 °C,如果超过 55 °C则硬盘风扇以全速运行。当硬盘温度低于 40 °C 时,风扇以最小转速运行。
=========== hwmon: ============
> Platform: drivetemp-scsi-0-40
Sensors Index Label Value
1 hwmon6/temp1 (temp1_input) 38000
> Platform: drivetemp-scsi-0-20
Sensors Index Label Value
1 hwmon4/temp1 (temp1_input) 41000
> Platform: drivetemp-scsi-0-0
Sensors Index Label Value
1 hwmon2/temp1 (temp1_input) 43000
> Platform: drivetemp-scsi-0-30
Sensors Index Label Value
1 hwmon5/temp1 (temp1_input) 41000
> Platform: drivetemp-scsi-0-10
Sensors Index Label Value
1 hwmon3/temp1 (temp1_input) 41000
> Platform: corsaircpro-hid-3-1
Fans Index PWM Channel RPM Channel Label RPM PWM Mode
1 1 1 fan1 4pin 2913 194 N/A
2 2 2 fan2 4pin 2811 194 N/A
3 3 3 fan3 4pin 5690 194 N/A
4 4 4 fan4 4pin 1144 156 N/A
5 5 5 fan5 4pin 2510 161 N/A
6 6 6 fan6 4pin 1078 153 N/A
第一步,配置 配置点 1
关于温度传感器的配置。
# 配置点 1
sensors:
- id: drivetemp1
hwmon:
platform: drivetemp-scsi-0-40
index: 1
- id: drivetemp2
hwmon:
platform: drivetemp-scsi-0-20
index: 1
- id: drivetemp3
hwmon:
platform: drivetemp-scsi-0-0
index: 1
- id: drivetemp4
hwmon:
platform: drivetemp-scsi-0-30
index: 1
- id: drivetemp5
hwmon:
platform: drivetemp-scsi-0-10
index: 1
第二步,配置 配置点 2
关于温度曲线的配置。
curves:
- id: drivetempCurve1
linear:
sensor: drivetemp1
min: 40
max: 55
- id: drivetempCurve2
linear:
sensor: drivetemp2
min: 40
max: 55
- id: drivetempCurve3
linear:
sensor: drivetemp3
min: 40
max: 55
- id: drivetempCurve4
linear:
sensor: drivetemp4
min: 40
max: 55
- id: drivetempCurve5
linear:
sensor: drivetemp5
min: 40
max: 55
- id: drivetempCurve # 定义“函数式”温度传感器,类型为最大值
function:
type: maximum
curves:
- drivetempCurve1
- drivetempCurve2
- drivetempCurve3
- drivetempCurve4
- drivetempCurve5
第三步,配置 配置点 3
风扇的配置。
fans:
- id: corsaircpro1
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 1
pwmChannel: 1
neverStop: false
curve: drivetempCurve
- id: corsaircpro2
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 2
pwmChannel: 2
neverStop: false
curve: drivetempCurve
- id: corsaircpro3
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 3
pwmChannel: 3
neverStop: false
curve: drivetempCurve
- id: corsaircpro4
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 4
pwmChannel: 4
neverStop: false
curve: drivetempCurve
- id: corsaircpro5
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 5
pwmChannel: 5
neverStop: false
curve: drivetempCurve
- id: corsaircpro6
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 6
pwmChannel: 6
neverStop: false
curve: drivetempCurve
完整的配置如下:
dbPath: "/etc/fan2go/fan2go.db"
runFanInitializationInParallel: false
maxRpmDiffForSettledFan: 20
fanResponseDelay: 2
tempSensorPollingRate: 200ms
tempRollingWindowSize: 10
rpmPollingRate: 1s
rpmRollingWindowSize: 10
fanController:
adjustmentTickRate: 200ms
pwmSetDelay: 5ms
# 配置点 1
sensors:
- id: drivetemp1
hwmon:
platform: drivetemp-scsi-0-40
index: 1
- id: drivetemp2
hwmon:
platform: drivetemp-scsi-0-20
index: 1
- id: drivetemp3
hwmon:
platform: drivetemp-scsi-0-0
index: 1
- id: drivetemp4
hwmon:
platform: drivetemp-scsi-0-30
index: 1
- id: drivetemp5
hwmon:
platform: drivetemp-scsi-0-10
index: 1
curves:
- id: drivetempCurve1
linear:
sensor: drivetemp1
min: 40
max: 55
- id: drivetempCurve2
linear:
sensor: drivetemp2
min: 40
max: 55
- id: drivetempCurve3
linear:
sensor: drivetemp3
min: 40
max: 55
- id: drivetempCurve4
linear:
sensor: drivetemp4
min: 40
max: 55
- id: drivetempCurve5
linear:
sensor: drivetemp5
min: 40
max: 55
- id: drivetempCurve # 定义“函数式”温度传感器,类型为最大值
function:
type: maximum
curves:
- drivetempCurve1
- drivetempCurve2
- drivetempCurve3
- drivetempCurve4
- drivetempCurve5
fans:
- id: corsaircpro1
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 1
pwmChannel: 1
neverStop: false
curve: drivetempCurve
- id: corsaircpro2
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 2
pwmChannel: 2
neverStop: false
curve: drivetempCurve
- id: corsaircpro3
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 3
pwmChannel: 3
neverStop: false
curve: drivetempCurve
- id: corsaircpro4
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 4
pwmChannel: 4
neverStop: false
curve: drivetempCurve
- id: corsaircpro5
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 5
pwmChannel: 5
neverStop: false
curve: drivetempCurve
- id: corsaircpro6
hwmon:
platform: corsaircpro-hid-3-1
rpmChannel: 6
pwmChannel: 6
neverStop: false
curve: drivetempCurve
statistics:
enabled: false
port: 9000
api:
enabled: false
host: localhost
port: 9001
profiling:
enabled: false
host: localhost
port: 9002
LSI3008 阵列卡控制
LSI3008 阵列卡本身不支持风扇控制,但是其温度又较高,有实际的温度控制需求。可以从某宝购买支持 PWM 控制的风扇粘贴在阵列卡表面。
要读取 LSI3008 的温度,需要下载 Storcli64 工具,该工具可以从以下地址获取,这里也提供百度云盘的下载地址。
支持 rpm 包的 linux 系统安装 rpm 格式的安装包,支持 deb 包的系统安装 deb 格式的安装包(飞牛系统)。二者都不支持的(群晖/威联通等),将 zip 解压后,复制可执行文件到 /opt/MegaRAID/storcli
目录下。

sudo dpkg -i storcli_007.3404.0000.0000_all.deb
deb 格式的软件包安装后,可执行文件位于 /opt/MegaRAID/storcli
目录下。
执行以下命令,如果看到输出,则软件安装正常且能够识别到硬件。
sudo /opt/MegaRAID/storcli/storcli64 /c0 show temperature
CLI Version = 007.3404.0000.0000 April 18, 2025
Operating system = Linux 6.12.18-trim
Controller = 0
Status = Success
Description = None
Controller Properties :
=====================
--------------------------------------
Ctrl_Prop Value
--------------------------------------
ROC temperature(Degree Celsius) 50
--------------------------------------
fan2go 支持从命令获取温度值。但是 storcli64 的输出内容较多。为简化操作,在 /usr/bin
下创建脚本文件 storcli
#!/bin/bash
# Wrapper script for MegaRAID storcli command to extract ROC temperature in millidegrees
/opt/MegaRAID/storcli/storcli64 /c0 show temperature | awk '/ROC temperature/ {printf "%.0f\n", $NF * 1000}'
下面,开始 fan2go 的 LSI3008 配置文件的编写。
第一步,配置 配置点 1
关于温度传感器的配置。
sensors:
- id: LSI3008
cmd:
exec: "/usr/bin/storcli"
第二步,配置 配置点 2
关于温度曲线的配置。
curves:
- id: LSI3008
linear:
sensor: LSI3008
min: 30
max: 65
第三步,配置 配置点 3
风扇的配置。
fans:
- id: LSI3008
hwmon:
platform: corsaircpro-hid
rpmChannel: 3
pwmChannel: 3
neverStop: true
curve: LSI3008
通过命令 sudo fan2go sensor -i LSI3008
验证 fan2go 是否正确的获取到 LSI3008 的温度。
高级配置及其他配置项
更多其他配置内容,可查看官方的说明文档。
启动 fan2go
将以下内容,保存为文件 /etc/systemd/system/fan2go.service
,之后执行 sudo systemctl enable --now fan2go
启动 fan2go 服务。
[Unit]
Description=Advanced Fan Control program
After=lm-sensors.service
[Service]
LimitNOFILE=8192
Environment=DISPLAY=:0
ExecStart=/usr/bin/fan2go -c /etc/fan2go/fan2go.yaml --no-style
Restart=always
RestartSec=1s
[Install]
WantedBy=multi-user.target
需要注意,首次运行 fan2go 时,fan2go 需要建立每一个已配置的风扇 PWM<->RPM 映射关系,这将会耗费数分钟的时间。