Transition Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About eudean

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. g++ No libraries aside from standard C/C++ libraries. You can glance at the source to see what I include. Just inspect the source, it's really straightforward. Take a look at if you've never worked with IO ports. There are python libraries that expose IO port access, e.g., but you could also do writes to /dev/port as mentioned in the tldp page. FYI there's no Makefile as there's only one self-contained source file. You just need to do g++ fancontrol.cpp (with whatever g++ arguments you want, like -o).
  2. I just wanted to mention that the it87 kernel module does the exact same memory accesses to control the fan speed, it just does them in the kernel and exposes control in sysfs rather than my script which does it from userspace and doesn't expose any control files. I think if you want to use lm-sensors you do need the kernel module, but you could write a bash script (or Python or anything else) that controls the fans doing the same writes to /dev/port, or you could call the fancontrol binary from a bash script to control the fans (by passing arguments to write a fixed PWM value). Also the binary should almost certainly work across a wide range of versions as it doesn't use any esoteric libraries. It could also be re-compiled from source as necessary.
  3. Try using sudo (i.e., sudo ./fancontrol). If you aren't root iopl will probably fail and you'll be writing to invalid memory very quickly (I don't have a lot of error checking for these kinds of things).
  4. So when developing I logged in via ssh to run the script from a shell. But for general usage you should use "Task Scheduler" (in the Control Panel) to create a task that runs at boot up that just executes the script. See for details. Then just reboot your NAS. The fans will take some time to stabilize so after you boot it, wait an hour or two, then check the hard drive temperatures in Storage Manager and they should be pretty close to 37 C (unless you're room is super hot or cold, in which case it may take longer). Then check on it periodically and it should be very close to 37 C just to make sure it's working fine. Unfortunately I don't see a way for DSM to send a notification if the temperature goes outside of a certain range (only it if goes above the hard drive operating temperature, which is kind of late to send a notification). Maybe someday I'll add something to the script for that.
  5. I recently installed Xpenology on a Terramaster F4-220 I picked up during the holiday sales that were going on. I noticed the hard drives were consistently operating at a very high temperature (50+ C while idle) so I decided to investigate how to control the fans. I had read elsewhere there is some BIOS option to drive the fans faster, but lacking the VGA dongle to get into the BIOS I figured I'd investigate how to control them from Linux. So I discovered the hardware contains an IT8772E chip for which Google helpfully brings up this datasheet: I noticed that there is already a kernel driver for this chip, but since I only needed very limited capabilities (just the ability to write the fan PWMs) I decided to just write a custom script to do this. I'm sharing it here so others can take advantage of it. I'm guessing it wouldn't be hard to also drive the LEDs to the right colors as well but I haven't spent time on that since I never look at the LEDs anyway. The basic flow of the code is: Initialize the IT8772E chip Write a default PWM value for the fans Read the max hard drive temperature and use a PID loop to calculate a new PWM value to drive the max hard drive temperature to some setpoint After playing with the PID values for a few days I concluded that just using a P value was sufficient to give decent behavior so I just left kp = 1, ki = kd = 0. I just modified the script to make all of these things overridable in case someone wants to play around with it further without having to recompile. With defaults I find it settles to reasonable values in about 30 minutes. By default the script uses a setpoint of 37 C but again this can be overridden. I chose this after looking at various suggestions online, it seems 30-40 C is the safest range to maintain for average temps in terms of drive failure rate, so 37 C should give some buffer in case of sudden spikes in utilization that PID doesn't react to quickly enough. My argument parsing is really simple, you can use ./fancontrol -h to see how to use the script. Here are some sample uses: ./fancontrol (default behavior) ./fancontrol -h (print out usage info) ./fancontrol 1 40 (enable debug logging, setpoint = 40) ./fancontrol 0 37 255 (use the maximum PWM value initially before entering the PID loop) ./fancontrol 0 37 150 10 50 80 0 0 0 0 (use PWM value 150 initially and disable PID by setting all coefficients to 0, this would be like hard-coding the PWM to 150 forever) Anyway, I hope other Terramaster users find this useful. I suspect this will also work on similar Terramaster NASes that use the same chip for fan control but I have only tested on the F4-220 since that's what I own. I've attached the cpp source and a binary built for x86_64 running DSM 6.2 using Synology's build environment (ds.x64-6.2). Some side notes: The synostorage daemon already reads drive temperatures and reports them in /var/run/synostorage/disks/sd[abcd]. I initially used these to drive my code but later realized these values may be updated very infrequently (as in many minutes) so I decided to poll via smartctl. I still rely on the disks listed in /var/run/synostorage to know which drives to query. I don't read the CPU temp (or any other sensors). I think keeping the drives at 40 C or below will likely be a stronger constraint on fan speed than CPU usage, but if you expect heavy CPU usage at times when there isn't heavy storage utilization (unlikely for a NAS) then this may not be what you want. I chose an MIT license for the source I don't really intend to maintain this long term except for myself but if people have suggestions let me know and I can try to tackle them. You can run this at boot time using "Task Scheduler" fancontrol fancontrol.cpp