After installing Fonz’ fun_plug (see tutorial on this), you will probably want work with like NFS or Torrent. This tutorial will show you how to do this.
Continue reading Activation and Deactivation of Daemons in Fonz fun_plug 0.7
After installing Fonz’ fun_plug (see tutorial on this), you will probably want work with like NFS or Torrent. This tutorial will show you how to do this.
Continue reading Activation and Deactivation of Daemons in Fonz fun_plug 0.7
The CH3SNAS, as well as other small nas devices, has a small fan at the back. This fan is necessary because the NAS can generate significant amounts of heat when one or two drives are used heavily.
Although the fan is speed-controlled through software provided by Conceptronic, the fan never switches off completely. Some people find this too noisy for quiet environments like bedrooms or even some offices. An obvious solution is to turn the CH3SNAS off entirely when it is not in use (e.g. at night), but this is very inconvenient and it gives problems when the CH3SNAS may be accessed occasionally by remote (Internet) users.
Thanks to the fun_plug, the user can change the fan control algorithm to reduce noise, save a bit of power and reduce wear on the fan itself.
By default, the fan is controlled by a program embedded within the CH3SNAS called fancontrol
. This program adjusts the fan speed depending on the temperature measured inside the CH3SNAS.
Conceptronic also provides two other utilities which are helpful to control the fan:
temperature
– shows the actual temperature (on some devices in Fahrenheit and on others in Celsius) by entering the command "temperature g 0"
fanspeed
– returns the current fan speed when you enter "fanspeed g"
. It can also set a new fan speed by entering the command "fanspeed w YourFanSpeed"
(where YourFanSpeed
is the desired speed in Rotations Per Minute).
There are different ways to control the fan. In any case the new software needs to stop (“kill”) the built-in fancontrol
program provided by Conceptronic before it takes over control.
One approach is to use the programs temperature
and fanspeed
within a simple bash
script that repeatedly measures the temperature and adjusts the fan speed accordingly. Such a script can even choose to turn off the fan entirely below a certain temperature. But a script-based approach, which, compared to a compiled C program, uses more (valuable) memory and CPU cycles.
Fortunately Fonz, the author of fun_plug, has written a small and efficient binary program named fanctl
. It controls the fan without relying on the temperature
and fanspeed
) programs and without using the bash
shell. This efficiency is nice as the program is intended to run as long as the CH3SNAS is powered up. By default, fanctl
adjusts the fan speed every 30 seconds if needed.
fanctl
Uli has created a package to simplify installation of fanctl
.
In this tutorial we assume that the fun_plug is already installed on the NAS and that you synchronized Uli’s repository (see here for instructions on how to do this). Afterwards install the package (see detailed instructions here):
funpkg -i /ffp/pkg/additional/ffp-misc/fanctl-*.tgz cp /ffp/etc/examples/fanctl.conf /ffp/etc/fanctl.conf
The final steps copies default configuration settings to the appropriate directory.
fanctl
Please make sure, that no other scripts than the original fancontroller are active! You can check this by:
ps aux|grep fan
This should show the following output (the process identification numbers will vary):
1431 root fancontrol 12620 root grep fan
These are all the running processes (ps
) which were filtered (grep
) on whether they include the text fan
somewhere in their name. Despite appearances, [http://en.wikipedia.org/wiki/Ps_(Unix)#Options aux] is not a command or name, but 3 separate options for ps
with a missing “-” this time.
Now test the first run of the fanctl
script by entering the following command on the command line:
sh /ffp/start/fanctl.sh start
After entering the above command, the fan will run with a audible noise for a few seconds. You can check the correct opertion of fanctl now:
ps aux|grep fan
This should show the following output (again the PID numbers will vary):
12628 root /ffp/sbin/fanctl /ffp/etc/fanctl.conf 12635 root grep fan
This shows that the fancontrol
process disappeared and was replaced by the fanctl
process (with its configuration file).
As the last step, you can activate the daemon permanently:
chmod a+x /ffp/start/fanctl.sh
fanctl
worksTo understand or to adjust the behaviour of fanctl
, you may want to inspect its configuration file /ffp/etc/fanctl.conf
. If you use the nanoeditor:
nano /ffp/etc/fanctl.conf
Under normal circumstances the defaults should be fine.
Do not change these values unless you completely understand the consequences.
Overheated hard drives can lead to data loss or early drive failure. So if you want to change the settings in the configuration file, please study the following documentation carefully and test any modifications you make carefully.
The graph (by Uli) explains how the program adjusts the fan speed. It assumes the default settings (which you won’t change unless you need to and know what you are doing – right?). Room temperature is typically about 20 degrees Celcius (68 degrees Fahrenheit).
When you boot the CH3SNAS, but hardly use the drives the temperature should increase a few degrees, but stay well below 40 degrees. In that case, the fan follows the blue line: it stays off because there is no real need to cool the CN3SNAS yet. However, when you use the drives a lot, the temperature can rise above 40 degrees. Especially if the room temperature also happens to be hot. This causes the fan to switch on. The fan speed (in RPM) follows the curved slope (part of a parabolic curve). The maximum fan speed is limited by default to 6300 RPM (called pwm_hi
). Like the original software, there is a actually a safety threshold as well: above 51 degrees, the CN3SNAS is turned off. The latter shouldn’t normally happen unless something goes very wrong (like a broken drive, or operating your CH3SNAS in the sauna).
Now assume that the CH3SNAS has become relatively hot (say 45 degrees Celcius), but the drives now enter a period of infrequent access. This causes the drive motors to automatically shut down, reducing heat production and causing the temperature to drop. Every 30 seconds, a drop in temperature will cause the fan to slow down. When the temperature drops below 40 degrees (called temp_hi
) the fan speed stabilizes for a while. When the temperature then drops below 37 degrees (called temp_lo
), the fan is turned off.
Note that turning the fan on and off occur at different temperatures. This is called (hysteresis). This reduces the chance that at some temperature the fan repeatedly runs for 30 seconds, then turns off for 30 seconds, and then turns on again.
If you want to change the temperatures (e.g. if the fan never switches off completely (NAS too warm) or you want to cool it down to a certain level), there are various values in the script for configuring these. All values have to be set in Celsius*1000
! E.g. 40°C
would be 40000
There are four different values:
temp_stop
: If the temperature decreases below this value, the fan is set to the speed, which is configured as the variable pwm_stop
(normally this will be zero and thus stops the fan). If the temperature rises about this temperature, nothing happens (hysteresis). Default is 37 degrees Celcius.
temp_lo
: If the temperature rises above this temperature, pwm_start
will be set for one second (Starts the fan). After this, the fan speed will be adjusted somewhere beween pwm_lo
and pwm_hi
– depending on the measured temperature. If the temperature drops below this temperature, the fan runs at pwm_lo
(hysteresis). Default is 40 degrees Celcius.
temp_hi
: If the temperature rises above this value, pwm_hi
is set as fan speed. Default is 50 degrees Celcius.
temp_crit
: If the temperature rises above this value, the CH3SNAS is shut down to prevent damage. Default is 51 degrees Celcius. Be extra careful with this value.
If you want to change the fan speed (e.g. if you think, the fan turns too slowly or if you want the fan to idle and not to stop), there are various values in the script for configuring these.
pwm_stop
: This is the speed which is set below temp_stop
. If set to zero, the fan will halt. It may not be a good idea to use really low non-zero values here (difficult to run the fan smoothly at these speeds).
pwm_start
: This is the speed which is set for one second if pwm_stop
was set and the temperature rises above temp_lo
again. (Default: 3200 rpm)
pwm_lo
: This is the speed which is set at temp_lo
. (Default: 2700 rpm)
pwm_hi
: This is the speed which is set at temp_hi
. (Default: 6300 rpm)
Between pwm_lo
and pwm_hi
the fan speed will be interpolated according to the following formula:
RPM = (pwm_hi - pwm_lo) * (temp - temp_lo) / (temp_hi - temp_lo) * (temp - temp_lo) / (temp_hi - temp_lo) + pwm_lo
fanctl.conf
Again, editing fanctl.conf should be done with care. Just editing the file will not cause the new values to be used immediately because the running program reads the file once when it starts. One safe way to reload a modified /ffp/etc/fanctl.conf
file is to simply reboot the CH3SNAS. When the program is started, it will load the modified /ffp/etc/fanctl.conf
file. Another way is to use
cd /ffp/start sh fanctl.sh status sh fanctl.sh restart sh fanctl.sh status
The sh fanctl.sh retart
stops and restarts the fan. Actually between the stop and the restart, fancontrol
is briefly run.
According to the graph, if you put the CH3SNAS in a very hot environment (e.g. 38 degrees Celcius), the fan will turn on – even when the hard disks are not being used. Turning the fan on wouldn’t help lower the device temperature: it will only get the device temperature closer to room temperature. Currently the software cannot distinguigh this condition (but this obviously also applies to the default fancontrol
software which never turns the fan off).
In exceptional conditions, the CH3SNAS will shut down if it ever reaches temp_crit
(typically 51′ Celcius). When it shuts down, it will create a file named OVERHEAT
in the root directory. By checking for this file and its creation or modification time, you can get confirmation about the cause of the shutdown.
See the file /ffp/etc/fanctl.conf
for more details how this works.
From an E-mail exchange with fonz (this hasn’t been tested):
PeterH> Other features might be more fun (e.g. log of temperature?).
That’s pretty easy. Just change /ffp/start/fanctl.sh and replace
/ffp/sbin/fanctl $fanctl_config >/dev/null 2>/dev/null </dev/null &with
/ffp/sbin/fanctl $fanctl_config >/mnt/HD_a2/fan.log 2>&1 </dev/null &You can plot nice graphs from the log file using gnuplot:
gnuplot> set timefmt "%Y-%m-%d %H:%M:%S" gnuplot> set xdata time gnuplot> plot '< grep fan /path/to/fan.log' u 1:4 w st, '' u 1:8 w st
If you deinstall fanctl
using
funpkg -r /ffp/pkg/additional/fanctl-2-1.tgz
and reboot your CH3SNAS, you will find using
ps aux|grep fan
that the original fancontrol
appication automatically reappears. This is because fanctl
is activated via a script (/ffp/start/fanctl.sh
) that stops the default fancontrol
process before starting the fanctl
program.
This implies that deinstalling funplug and rebooting will also return fan behaviour back to the default behavior and default mechanisms provided by Conceptronic.