2017년 5월 18일 목요일

리눅스 홈서버 팬속도 조절하기 home server fancontrol

집에 홈서버를 하나 돌리고 있어요. 저전력으로
작고 얇은...
그런데... 팬소리가 좀 거슬려요.
이번에는 팬속도를 조절해야겠다 마음먹었어요.

검색한 끝에

https://possiblelossofprecision.net/?p=450

여기 포스팅을 보고 그대로 따라했습니다.

전 이미 sensors 설치를 해놓은 터라

일부만 따라했어요.

순서는
1. 센서라이브러리(lm_sensors)를 설치합니다.
2. pwmconfig 실행합니다.
3. fancontrol을 실행합니다.
4. 시스템시작시에 자동으로 실행되게 합니다.

2번에서 헤매게 되는데요.
설명은 본문아래에서 다시 하겠습니다.

1. Detecting sensors

Before you can read out any temperature values and change the fanspeed accordingly, you have to your operating system which sensors you are actually using.
Fortunately, there is a small program that does the job for you. sensors-detect comes with lm_sensors, so we make sure, the latest version of lm_sensors is installed
yum install lm_sensors
before we start sensors-detect
Pretty cool, huh? Make sure, the lm_sensors daemon gets started automatically
chkconfig lm_sensors on

2. Configuring sensors and fans

The fancontrol script can automatically respond to temperature changes of your system by changing fanspeeds. Basically, we have to map one temp-sensor to one fan controller. fancontrol‘s config-file can be easily manipulated with pwmconfig. The program is quite self-explaining; It can even create detailed correlation with gnuplot automatically.
If you later want to change some values manually, you can also edit /etc/fancontrol without pwmconfigusing your favourite editor. See also fancontrol manpage.

3. Automatically starting fancontrol

Unfortunately there comes no init script with fancontrol in Fedora or CentOS. So we have to ensure, fancontrol gets started automatically during boot. The easiest way is to put fancontrol into rc.local
# echo 'fancontrol &' >> /etc/rc.local
Sending the process to background with a subsequent ampersand is crucial. Otherwise the boot process may hang.
You can of course write your own fancontrol init script if you want to do the full Sys V style init stuff.

Restart the computer and enjoy silence!

아래는 pwmconfig를 실행했을 때 볼 수 있습니다.
[root@localhost ~]# pwmconfig
# pwmconfig revision $Revision$ ($Date$)
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

Found the following devices:
   hwmon0 is acpitz
   hwmon1 is coretemp
   hwmon2/device is it8772

Found the following PWM controls:
   hwmon2/device/pwm1           current value: 0
   hwmon2/device/pwm2           current value: 150
   hwmon2/device/pwm3           current value: 76

Giving the fans some time to reach full speed...
Found the following fan sensors:
   hwmon2/device/fan1_input     current speed: 0 ... skipping!
   hwmon2/device/fan2_input     current speed: 6683 RPM
   hwmon2/device/fan3_input     current speed: 0 ... skipping!

Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue:(첫번째 팬이 멈추고 온도가 올라갈 수 있다 원하지 않으면 컨트롤 씨, 엔터는 시작!)

Testing pwm control hwmon2/device/pwm1 ...
  hwmon2/device/fan2_input ... speed was 6683 now 6683
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon2/device/pwm1,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? n(팬이 멈추는 것을 들었나요?)

Testing pwm control hwmon2/device/pwm2 ...
  hwmon2/device/fan2_input ... speed was 6683 now 0
    It appears that fan hwmon2/device/fan2_input
    is controlled by pwm hwmon2/device/pwm2
Would you like to generate a detailed correlation (y)?(상세설정을 원하는가?)
    PWM 255 FAN 6683
    PWM 240 FAN 6683
    PWM 225 FAN 6553
    PWM 210 FAN 6308
    PWM 195 FAN 6026
    PWM 180 FAN 5672
    PWM 165 FAN 5314
    PWM 150 FAN 4963
    PWM 135 FAN 4560
    PWM 120 FAN 4141
    PWM 105 FAN 3688
    PWM 90 FAN 3214
    PWM 75 FAN 2657
    PWM 60 FAN 2076
    PWM 45 FAN 0
    Fan Stopped at PWM = 45


Testing pwm control hwmon2/device/pwm3 ...
  hwmon2/device/fan2_input ... speed was 6683 now 6683
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon2/device/pwm3,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)?(팬이 멈추는 것을 들었나요?)

Testing is complete.
Please verify that all fans have returned to their normal speed.

The fancontrol script can automatically respond to temperature changes
of your system by changing fanspeeds.
Do you want to set up its configuration file now (y)?(파일에 반영할까요?)
What should be the path to your fancontrol config file (/etc/fancontrol)?(경로는 디폴트로)
Loading configuration from /etc/fancontrol ...

Select fan output to configure, or other action:
1) hwmon2/device/pwm2  3) Just quit           5) Show configuration
2) Change INTERVAL     4) Save and quit
select (1-n): 1(1번을 설정함)

Devices:
hwmon0 is acpitz
hwmon1 is coretemp
hwmon2/device is it8772

Current temperature readings are as follows:
hwmon0/temp1_input      26
hwmon1/temp2_input      37
hwmon1/temp3_input      37
hwmon1/temp4_input      39
hwmon1/temp5_input      39
hwmon2/device/temp1_input       32
hwmon2/device/temp2_input       33
hwmon2/device/temp3_input       -70

Select a temperature sensor as source for hwmon2/device/pwm2:
1) hwmon0/temp1_input
2) hwmon1/temp2_input
3) hwmon1/temp3_input
4) hwmon1/temp4_input
5) hwmon1/temp5_input
6) hwmon2/device/temp1_input
7) hwmon2/device/temp2_input
8) hwmon2/device/temp3_input
9) None (Do not affect this PWM output)
select (1-n): 6(어떤센서를 사용하나요?)

Enter the low temperature (degree C)
below which the fan should spin at minimum speed (20): 30(몇도일때 최저속도로 할까요?)

Enter the high temperature (degree C)
over which the fan should spin at maximum speed (60): 70(몇도일때 최고속도로 할까요?)

Enter the minimum PWM value (0-255)
at which the fan STOPS spinning (press t to test) (100): 45 (언제 팬이 멈추었나?)

Enter the minimum PWM value (45-255)
at which the fan STARTS spinning (press t to test) (150): 60 (언제 팬이 돌기시작했나?)

Enter the PWM value (0-45) to use when the temperature
is below the low temperature limit (0): 45 (저온일 때 사용할 PWM값은?) 

Enter the PWM value (45-255) to use when the temperature
is over the high temperature limit (255): 180(고온일때 사용할 PWM값은?)


Select fan output to configure, or other action:
1) hwmon2/device/pwm2  3) Just quit           5) Show configuration
2) Change INTERVAL     4) Save and quit
select (1-n): 4(저장하고 종료)

Saving configuration to /etc/fancontrol...
Configuration saved
[root@localhost ~]# fancontrol (실행)
Loading configuration from /etc/fancontrol ...