Building an additional Kernel Module for the DNS-320 / DNS-325

A while back i updated the openvpn-package with the tun.ko for the DNS-320 and DNS-325. Problem was, that i needed to compile a kernel module first. Thankfully D-Link provides a ZIP-File with the sources of Code used for the DNS-320. Unfortunately it didn’t work out of the box, but i was able to pull a script which works together for you. If you want to download all my finished modules just visit this page.
Continue reading Building an additional Kernel Module for the DNS-320 / DNS-325

Output of /proc/cpuinfo on the D-Link DNS-325

Here the output of cat cat /proc/cpuinfo on the D-Link DNS-325:

Processor       : ARM926EJ-S rev 1 (v5l)
BogoMIPS        : 1196.03
Features        : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant     : 0x2
CPU part        : 0x131
CPU revision    : 1
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 16384
I assoc         : 4
I line length   : 32
I sets          : 128
D size          : 16384
D assoc         : 4
D line length   : 32
D sets          : 128
 
Hardware        : Feroceon-KW
Revision        : 0000
Serial          : 0000000000000000

Output of /proc/meminfo on the D-Link DNS-325

Here the output of cat cat /proc/meminfo on the D-Link DNS-325:

MemTotal:       255472 kB
MemFree:        115328 kB
Buffers:         22200 kB
Cached:          90708 kB
SwapCached:          0 kB
Active:          65260 kB
Inactive:        56680 kB
SwapTotal:      530040 kB
SwapFree:       530040 kB
Dirty:               4 kB
Writeback:           0 kB
AnonPages:        9048 kB
Mapped:           9948 kB
Slab:            15024 kB
SReclaimable:     5036 kB
SUnreclaim:       9988 kB
PageTables:        488 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:    657776 kB
Committed_AS:    55196 kB
VmallocTotal:   385024 kB
VmallocUsed:      1284 kB
VmallocChunk:   383736 kB

Output of /proc/cpuinfo on the D-Link DNS-313

Here the output of cat cat /proc/cpuinfo on the D-Link DNS-313:

Processor       : FA526id(wb) rev 1 (v4l)
BogoMIPS        : 231.01
Features        : swp half
CPU implementer : 0x66
CPU architecture: 4
CPU variant     : 0x0
CPU part        : 0x526
CPU revision    : 1
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format B
Cache format    : Harvard
I size          : 16384
I assoc         : 2
I line length   : 16
I sets          : 512
D size          : 8192
D assoc         : 2
D line length   : 16
D sets          : 256
 
Hardware        : GeminiA
Revision        : 0000
Serial          : 0000000000000000

Output of /proc/cpuinfo on the D-Link DNS-343

Here the output of cat cat /proc/cpuinfo on the D-Link DNS-343:

Processor       : ARM926EJ-Sid(wb) rev 0 (v5l)
BogoMIPS        : 499.71
Features        : swp half thumb fastmult vfp edsp
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
 
CPU part        : 0x926
CPU revision    : 0
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 32768
I assoc         : 1
 
I line length   : 32
I sets          : 1024
D size          : 32768
D assoc         : 4
D line length   : 32
D sets          : 256
 
Hardware        : Feroceon
Revision        : 0000
Serial          : 0000000000000000

Compiling Software for the Fonz fun_plug

This tutorial is for advanced users only!

Fonz provides many pre-compiled packages for the NAS in his repository, but obviously cannot provide every package which someone out there might need. So to help users compile and link packages themselves, Fonz has created a complete software environment for building packages for the NAS device.

This ffpbuildenv environment consists of a few scripts and a standardized process for building software packages. It runs on the NAS itself, rather than requiring special cross-compilation tools on a PC. This helps guarantee full compatibility with the target system and ensures that the environment is familiar to developers with a Linux background.

The following tutorial builds on Fonz’s work, but also contains procedures and descriptions by Uli. User PeterH did his usual testing and polishing routine on this text.

Contents

Preparations

Setup a fun_plug and install ALL packages available as described in the linked tutorial.

Setup

ffpbuildenv can best be installed on one of the hard disks:

mkdir /mnt/HD_a2/ffpbuildenv
cd /mnt/HD_a2/ffpbuildenv
svn co svn://inreto.de/svn/dns323/funplug/trunk .

These steps create a new directory on drive /mnt/HD_a2/ and copy the required files from Fonz’ repository using the [http://en.wikipedia.org/wiki/Subversion_(software) Subversion] version control system.

General Use

Chrooting to the build environment

To get a well-defined environment, you chroot to this directory using a script appropriately called chroot.sh:

cd /mnt/HD_a2/ffpbuildenv/
sh chroot.sh
cd /mnt/HD_a2/ffpbuildenv/source/

It makes the ffpbuildenv look like the root directory of the file system, at least for the current process. Note that the chroot step creates a new command shell running within your current command shell: if you later exit from the that shell, you end up back in the original shell.

Downloading the distribution file

cd /mnt/HD_a2/ffpbuildenv/source/
./Make.sh -F <PACKAGENAME>

Compiling a package

cd /mnt/HD_a2/ffpbuildenv/source/
./Make.sh <PACKAGENAME>

The compiled and packaged archive is placed in /mnt/HD_a2/ffpbuildenv/packages/ then. Errors are logged to /mnt/HD_a2/ffpbuildenv/build-logs/--.log

Setting up a package

If you take a look into the directory of a package, you will see several files. In the following text, I will describe lighttpd if not stated otherwise.

Required files

PR

Tells the Revision of the compiled package. E.g. if you compiled a package, forgot to include something and want to redo the package, e.g. the third version of php-5.2.6: php-5.2.6-3.tgz

1

PV

This is the version of the source code, e.g. lighttpd-1.4.20.tar.bz2

1.4.20

SRC_URI

Link to the source-file. You can use the following variables:

  • $PV – Packageversion – Value from above
  • $PN – Packagename – Value from above
  • $P – Concated Variable: “Packagename-Packageversion” ($PN-$PV)
http://www.lighttpd.net/download/lighttpd-$PV.tar.bz2

This will result in http://www.lighttpd.net/download/lighttpd-1.4.20.tar.bz2

Optional files

DESC

Describes the package. If present, it is shown during installation.

Lighttpd is a secure, speedy, compliant, and very flexible web-server
which is designed and optimized for for high-performance environments.
With a small memory footprint compared to other web-servers, effective
management of the CPU-load, and advanced feature set (FastCGI, SCGI,
Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the
perfect solution for every server that is suffering load problems.
[pkgsrc]

HOMEPAGE

This is the general homepage of the program.

http://www.lighttpd.net/

doinst.sh

This file gets executed during the installation of a compiled package. Here you can add additional commands, like adding system accounts or printing additional information.

This file is not needed in lighttpd, the code below is from sudo

def()
{
        if [ ! -r "$1" ]; then
                mv $1.new $1
        elif cmp -s $1 $1.new; then
                rm $1.new
        fi
}
 
def ffp/etc/sudoers

configure.sh

This file is used for configuring the source code with other commands than ./configure. If it is not available ./configure with the optional configure_args (see below) will be run in the source directory.

This file is not needed in lighttpd, the code below is from openssl

    ./config \
        --prefix=$CPREFIX \
        --openssldir=$CSYSCONFDIR/ssl \
        zlib shared

configure_args

These arguments are used, if there is no configure.sh available in the directory. Only the part after ./configure is included!

--libdir=$CPREFIX/lib/$P
--program-prefix=""
--with-openssl
--with-pcre
--with-zlib

destdir.sh

Optional

This file is used for “make” on the source code. If it is not available,

make DESTDIR=$D install

will be used in the source directory.

This file is not needed in lighttpd, the code below is from screen

    make DESTDIR=$D install
    mkdir -p $D$CPREFIX/etc
    install -m 0644 etc/etcscreenrc $D$CPREFIX/etc/screenrc

destdir-*.sh

Additional actions like moving or adding files. * can be replaced by etc or whatever, they all are run after compilation.

This is the content of destdir-etc.sh:

mkdir -p $D$CPREFIX/etc/examples
cd $X/etc/examples
install -m 0644 -o root -g root \
        lighttpd.conf lighttpd.conf-with-php \
        $D$CPREFIX/etc/examples

start-*.sh

These files get installed into the directory “/ffp/start/” during the installation. These contain a starter file.

This is the content of start-kickwebs.sh:

#!/ffp/bin/sh
 
# PROVIDE: kickwebs
# REQUIRE: LOGIN
# BEFORE: lighttpd
 
. /ffp/etc/ffp.subr
name="kickwebs"
start_cmd="kickwebs_start"
stop_cmd=:
 
kickwebs_start()
{
        echo "Kicking webs ..."
        killall webs
}
 
run_rc_command "$1"

This is the content of start-lighttpd.sh:

#!/ffp/bin/sh
 
# PROVIDE: lighttpd
# REQUIRE: LOGIN
 
. /ffp/etc/ffp.subr
 
name="lighttpd"
command="/ffp/sbin/lighttpd"
lighttpd_flags="-f /ffp/etc/lighttpd.conf"
required_files="/ffp/etc/lighttpd.conf"
 
run_rc_command "$1"

Walk-through

Install an editor (like nano), you will need one for editing the above files.

This walk-through will show you how to compile nano.

We start by changing to the correct directory:

>cd /mnt/HD_a2/ffpbuildenv/source/

Now we create the directory and change to it:

mkdir nano
cd nano

We open http://www.nano-editor.org/ for the latest stable version, which is 2.0.9. Open the file PV for the package version:
And enter 2.0.9.

Reset PR, we do this process for the first time. Open PR:
And enter 1.

Now we search for the [http://www.nano-editor.org/download.php download-url]. Is there a consistent way of numbering the releases? The example of nano shows us this numbering:

http://www.nano-editor.org/dist/v2.0/nano-2.0.6.tar.gz
http://www.nano-editor.org/dist/v2.0/nano-2.0.7.tar.gz
http://www.nano-editor.org/dist/v2.0/nano-2.0.8.tar.gz
http://www.nano-editor.org/dist/v2.0/nano-2.0.9.tar.gz

Do you see the similarity?
If so, then we can substitute the version by using $PV:

http://www.nano-editor.org/dist/v2.0/nano-$PV.tar.gz

If not, you need to enter the url manually:

http://www.nano-editor.org/dist/v2.0/nano-2.0.9.tar.gz

Pull this URL to SRC_URI.

Now we fulfilled the requirements for compiling, but nano will fail in some sections with these settings due to missing libraries (spellchecker). So we need to add some configure arguments using configure_args:

--enable-nanorc
--enable-color
--enable-multibuffer
--disable-speller

Now everything is set for compiling. Now we chroot to the respective directory:

sh /mnt/HD_a2/ffpbuildenv/chroot.sh
cd /mnt/HD_a2/ffpbuildenv/source/

And run the download:

./Make.sh -F nano

And run the compilation:

./Make.sh nano

This will take a while. If you get you prompt back and the line above states “OK.” everything went fine and you will find the final package in /mnt/HD_a2/ffpbuildenv/packages/. Otherwise, you should check the log:

tail /mnt/HD_a2/ffpbuildenv/build-logs/nano*log

Softwaredetails of the Conceptronic CH3SNAS

Supported protocols

Configuration interface showing servers
Configuration interface showing servers
A computer or user can communicate with the CH3SNAS using a range of protocols.

Servers

  • SMB/CIFS server
    This provides the basic file server functionality on the local-area network.
  • FTP server
    This is mainly for allowing the files to be accessed via the Internet. Such access will normally require some configuration of the home router/gateway as general access from the outside to devices on the LAN is normally filtered by the gateway’s firewall function. A typical router (e.g. Linksys WRT54G) can be configured to direct incoming ftp requests (port 21) to the IP address of the NAS. The NAS, in turn, can be configured via the browser interface to only allow access to some directories, to request a user/password or to give only read access.
  • Print server
    Technically this is part of the SMB/CIFS protocol suite. It allows the CH3SNAS to act as a print server on the local network.
  • uPnP (Universal Plug-and-Play)
    This is a set of protocols which allows the CH3SNAS to be discovered as a source of multimedia (music, video, pictures) and to allow a uPnP-enabled rendering device such as a network-enabled video renderer to see and access the available media. Probably the most common current uPnP-enabled rendering devices are Windows PCs running Microsoft Media Player.
  • iTunes server
    Essentially iTunes is, as a networking protocol, Apple’s proprietary counterpart to uPnP. Common iTunes rendering devices are computers running
  • HTTP server (limited)
    There is a small HTTP server to generate and process the HTML forms used to configure the CH3SNAS. That configuration interface can be accessed via a web browser using a computer on the local-area network (or if desired – mind the security – from the Internet). This HTTP server process is known as “Webs” and is from GoAhead. Users interested in using an HTTP server for other uses should consider installing the Lighttpd package under fun_plug.
  • DHCP server
    In case the CH3SNAS is used in a network without a DHCP server, the CH3SNAS can be configured to provided all devices with a unique IP-address. This will presumably be seldom used, but can help if you want to connect the CH3SNAS to, for example, a stand-alone laptop. The laptop sees a more or less fully functioning network without having to temporarily reconfigure the laptop to use static IP address.

Clients

  • NTP client
    The CH3SNAS can use the Network Time Protocol to get the current time from NTP servers on the internet.
  • DHCP client
    Although the CH3SNAS can be bound to a fixed IP address, it can also get its IP address from a local DHCP server.
  • E-mail client
    The CH3SNAS can be configured to automatically send e-mail to its administrator to notify about certain events.
  • FTP client
    The CH3SNAS can be configured to automatically download files at scheduled times from an FTP server.
  • HTTP client
    The CH3SNAS can be configured to automatically download files at scheduled times from an HTTP server.

Client/server

  • Telnet (requires fun_plug)
    The CH3SNAS contains support for establishing telnet sessions, whereby a remote user can login to the machine via an unsecure connection.
  • SSH (requires fun_plug)
    SSH is a modern successor to telnet. SSH fixes security problems in telnet by encrypting traffic between both machines.

Available firmware and upgrades

Conceptronic regularly provides updates of the firmware (embedded software, or if you like: operating system and servers) inside the CH3SNAS. These are available for download at Conceptronic.net. Test versions (betas and “release candidates”) are also made available for a more technical audience.

You may want to see our overview on all versions to see the new features and if any major issues have been reported. There is also a guide on upgrading the firmware available here

[ return to CH3SNAS page ]

Store-Passwd.sh for the DNS-343 and Acer easystore NAS

Fonz Version of the store-passwd.sh-Script for the DNS-343 and the Acer easystore NAS can be downloaded like this:

wget http://wolf-u.li/u/121 -O /ffp/sbin/store-passwd.sh

The Content of this script is the following:

#!/ffp/bin/sh
 
PATH=/ffp/sbin:/ffp/bin:$PATH
 
echo "Mounting flash ..."
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
 
echo "Updating files ..."
for d in /sys/mtd1 /sys/mtd2 /mnt/HD_a4/.systemfile/AccountFile /mnt/HD_b4/.systemfile/AccountFile; do
    if [ -d "$d" ]; then
	for f in /etc/passwd /etc/group /etc/shadow /etc/samba/smbpasswd; do
	    b=$(basename $f)
	    if [ -e "$d/$b" ]; then
		echo "  $d/$b"
		cp -f $f $d
	    fi
	done
    fi
done
 
echo "Unmounting ..."
sync
umount /sys/mtd1
umount /sys/mtd2
 
echo "Done."

Inspired by this Thread, i (Uli) did a rewrite of the store-passwd.sh-script. You need to use BASH for this to execute. Better use the Script above if you are not sure!

#!/ffp/bin/sh
# This script was written by Ulrich Wolf <ffp [a] wolf-u [dot] li>
# Inspired by the original Scripts of fonz and OneArmedMan
 
# Defining the various locations for these files:
BACKUPLOCATION[0]="/sys/mtd1"
BACKUPLOCATION[1]="/sys/mtd2"
BACKUPLOCATION[2]="/mnt/HD_a4/.systemfile/AccountFile"
BACKUPLOCATION[3]="/mnt/HD_b4/.systemfile/AccountFile"
 
# Defining the backup-locations of the files
BACKUPFILE[0]="/etc/shadow"
BACKUPFILE[1]="/etc/group"
BACKUPFILE[2]="/etc/passwd"
BACKUPFILE[3]="/etc/samba/smbpasswd"
# Inactive Files
#BACKUPFILE[4]="/etc/ftp_tbl"
#BACKUPFILE[5]="/etc/ftpgroup"
 
# Mounting the internal DRAM
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
 
# Iterate through the files for backup of the files
for BUFILESEQ in $(seq 0 $((${#BACKUPFILE[@]} - 1)))
do
	# Iterate through the backup-locations of the files
	for BULOCSEQ in $(seq 0 $((${#BACKUPLOCATION[@]} - 1)))
	do
		if [ -e ${BACKUPLOCATION[$BULOCSEQ]}/${BACKUPFILE[$BUFILESEQ]##*/} ]; then
			# File exists, copy the original one
			echo -n "${BACKUPFILE[$BUFILESEQ]##*/} found in ${BACKUPLOCATION[$BULOCSEQ]}, copying"
			cp -f ${BACKUPFILE[$BUFILESEQ]} ${BACKUPLOCATION[$BULOCSEQ]}/. 2> /dev/null && echo "done" || echo "failed"
		else
			# File does not exist, skip
			echo "${BACKUPFILE[$BUFILESEQ]##*/} not found in ${BACKUPLOCATION[$BULOCSEQ]}, skipping"
		fi
	done
done
 
 
echo -n "Flushing unwritten filesystem I/O buffers..."
sync && echo "done" || echo "failed"
 
# Unmount the internal DRAM
umount /sys/mtd1
umount /sys/mtd2
 
echo "Backup complete"
exit 0

Installation and Configuration of fanctl for Fonz fun_plug

German version of this tutorial

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

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.

CH3SNAS fan
CH3SNAS fan
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.

Contents

  1. Replacing the default fan control software
    1. The standard fan control solution
    2. Using shell scripts versus using binaries
  2. Installation
    1. Installing fanctl
    2. Activating fanctl
  3. How fanctl works
    1. Warning!
    2. The graph
    3. Temperatures
    4. Fan speed
    5. Changing fanctl.conf
  4. Notes
    1. A CH3SNAS in a hot room
    2. Shut down on overheating
    3. Logging the temperature
    4. Deinstallation

Replacing the default fan control software

The standard fan control solution

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).

Using shell scripts versus using binaries

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.

Installation

Installing 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.

Activating 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

How fanctl works

To 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.

Warning!

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

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).

Fanctl adjusts the fan speed depending on the measured temperature
Fanctl adjusts the fan speed depending on the measured temperature

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.

Temperatures

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.

Fan speed

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

Changing 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.

Notes

A CH3SNAS in a hot room

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).

Shut down on overheating

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.

Logging the temperature

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

Deinstallation

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.

Installing and Uninstalling Packages and Activation and Deactivation of Daemons in Fonz fun_plug 0.5

German version of this tutorialAfter installing Fonz’ fun_plug (see tutorial on this), you will probably want additional packages or Daemons like NFS or Torrent.

The commands below are ONLY for fun_plug Version 0.5
Please check here for newer tutorials!

Continue reading Installing and Uninstalling Packages and Activation and Deactivation of Daemons in Fonz fun_plug 0.5