DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-01-29 12:27:30

Paul
Member
From: Landshut, Germany
Registered: 2007-01-19
Posts: 35
Website

Fan does run all the time :-(

Is there a built-in way to shut down the fan when for example the discs are in sleep mode??

My fan is running all the time (at ~ 2500rpms)...

well, there is a process called 'fancontrol'... but I'm thinking about writing a small script myself which monitors the temperature of the drives ('temperature g 0') and accordingly set the fan speed. if the drives are in sleep mode, turn off the fan ('fanspeed w 0')....
but... how can I find out if the drives are in sleep mode?? Yet I found only a dmesg entry, but that's not really the best way I think...

Offline

 

#2 2007-01-30 14:04:04

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

Such script would be excellent... My drives spin down normally, but the fan is annoying, when running all the time sad Good luck smile

Offline

 

#3 2007-02-05 01:55:29

gotdiskey
Member
Registered: 2007-01-26
Posts: 17

Re: Fan does run all the time :-(

All the time here too. There seem to be code to handle this though.

Code:

# # ls /usr/sbin/fan*

/usr/sbin/fancontrol  /usr/sbin/fanspeed
# # ls /sbin/fan*

/sbin/fan.script
# # cat /sbin/fan.script

#temperature w 1 43
#sleep 1
#temperature w 2 47
#sleep 1
fanspeed w 0
sleep 1
fanspeed w 2500
sleep 5
fanspeed g > /tmp/fan_status
# # cat /tmp/fan_status

2495
# # ps | grep fan

 1543 root        220 S   fancontrol
 2847 root        244 S   grep fan
# #

/gotdiskey

Offline

 

#4 2007-02-05 18:20:55

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

Ok, toady I just couldn't stand the fan sound... Disassembled the unit, tried to change the fan, but only found that original fan in fact IS silent! Tried 2 other fans, but original one was the most silent. Unfortunately best fans I have and use are all 12V, so no luck. So I decided not to care about damn warranty smile Cut out "protective" piece of plastic from the back plate, enlarged the opening, added some padding. After that the unit is MUCH more quiet, in fact I can barely hear it now smile Well, the original "brute force" idea works after all, at least in my case, haha smile

While comparing fans and playing with the unit I "discovered" that there surely IS some fan rpm management working in DNS-323. In the boot process there is a phase in which fan runs at full speed and then settles down to a low rpm. It is a HUGE difference in sound. So thermal management seems to work - the only problem is, that even if both drives are powered down (in sleep state), fan still runs. It would make sense to spin down (turn off completely) the fan as soon as both disks are in sleep state, so the box would be totally silent when not in use. I wonder if it is possible just by modifying the code gotdiskey just mentioned (in next FW?). Well, I guess this won't happen anyway smile

I made some quick pictures from the process, you can see them with some notes here - http://members.chello.sk/ondro727/

Offline

 

#5 2007-02-06 17:58:12

someguy
Member
Registered: 2007-01-17
Posts: 47

Re: Fan does run all the time :-(

@ondro727 - Very cool !! 
- How did you modify the size of the hole? (looks like you did a clean job. Did you use a dremel?).
- I wonder what script we can use combining "fanspeed w 0", "temperature g", and some way to detect disk spin-down.

I've summarized things - a work-in-progress here:
http://dns323.kood.org/hardware:fan

Please Contribute!!  Everyone registered here can edit! Let's try to dig deep. best wishes, all!!

Offline

 

#6 2007-02-06 23:33:15

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

@someguy:

Don't let your eyes fool you - the hole and all modification is FAR from perfect, but I don't have tools and time to make it as perfect as I'd like... Used sharp knife (sorry, I don't know the english word for it...) to cut out the central piece of plastic, then enlarged the hole using some rasp (I am not sure of this word either wink ) and as soon as it was wider than fan itself, I finished it with some soft abrasive coated paper. Nothing special big_smile

Well, Linux is not a big friend of mine (shame on me), so there's no way I can help with the script sad But if there is anyone... wink

As I said, the real downside of this process is that you void warranty by this modification. Anyway, if the unit dies, I still can use original back plate from other DNS-323 from a friend of mine smile

Offline

 

#7 2007-02-07 16:36:11

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

I wrote a small and simple script to control the fan. My fan was often running at 4000 rpm and the noise was getting on my nerves...

First kill the fancontrol process so that it does not interfere. Then you can start the following script (ctrl_fanspeed.sh) in the background ( ./ctrl_fanspeed & ). At temperatures below T1 it sets the fan to RPM1 while at temperatures above T2 it sets it to RPM2. At temperatures between T1 and T2 it linearly interpolates the speed of the fan from RPM1 at T1, to RPM2 at T2. The temperature is checked every update_interval seconds.

It seems to work for me but use it at your own risk smile

##################################################
#!/bin/sh
#
update_interval=15
T1=40
T2=60
RPM1=1000
RPM2=5000

while [ 1 ]
do
  T=`temperature g 0|sed -n ' s/<temperaturertc>: get temperature =//p'`
  rpm=`fanspeed g`
  newRPM=$RPM1
  if [ $T -gt $T1 ]
  then                   
      newRPM=`expr  \( $T \> $T2 \) \* $RPM2 \| $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \)`   
  fi
  fanspeed w $newRPM 
  sleep $update_interval
done

###############################################

Offline

 

#8 2007-02-07 17:01:53

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Re: Fan does run all the time :-(

I guess next logical step would be to broadcast your fanspeed and temperature to an external node, e.g. your Mediacenter.

.
.
  fanspeed w $newRPM 
  #
  echo "TEMP: $T;FAN: $newRPM" | /mnt/HD_a2/lnx_bin/nc 192.168.0.255 60606
  #
  sleep $update_interval
.
.

...and on your XBMC you create a small Python script which listens to 60606 and show some information on the screen.
...or nc.exe -l -p1234 on your PC will give you the details....
...or why not a neat Firefox plugin ;-)
...or an SMS gateway, lol

Well done! Please add your information to the Wiki http://dns323.kood.org/hardware:fan

/Apan

Offline

 

#9 2007-02-07 17:56:34

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

I was thinking more in the line of logging information into a file and using gnuplot on the sarge side to create graphs of the temperature, fanspeed and load as a function of time smile I already have apache installed in sarge so this would enable one to make a nice webpage with these graphs. When I have time I will probably make these scripts, right now I have to get some work done and stop playing...

Offline

 

#10 2007-02-07 19:04:24

someguy
Member
Registered: 2007-01-17
Posts: 47

Re: Fan does run all the time :-(

Nice: Does anyone know where the (two?) temperature probe(s) are?  Could be fun to experiment : ).  We're relying on the black-box algorithm of g 0.   

It would also be great to have a simple script that simply detects whether or not the drives are sleeping or not.
I like the monitoring server idea. net-snmp is an option..

Also, now that I think of it, what if the script fails? -- we might have a fire on our hands - or do we get an smtp alert? : ).

- one more thing:  we could also use a simple script to detect whether a system uses Farenheit or Celcius to store Temperature -- this way scripts could be more transportable (e.g: if someone writes a Script with Max temperatures at 176 Farenheit, but they run it on a Celcius-based machine... trouble!!)

Last edited by someguy (2007-02-07 22:27:12)

Offline

 

#11 2007-02-07 19:06:13

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

Added a cleaned up version of the script to the wiki.

Offline

 

#12 2007-02-07 19:23:04

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

someguy wrote:

Nice: Does anyone know where the (two?) temperature probes are?  Could be fun to experiment : ).  We're relying on the black-box algorithm of g 0.  Unknown if g 0 returns a problem if g 1 maxes, while g 2 stays cool, for instance.

I think there is only one temperature probe that is accessed by g 0. Unfortunately I have no idea where it's located...

Code:

# temperature
temperature - query and set the temperature sensor

Usage: temperature [function]

Functions:
 h - show this help
 w [1,2] degree - set temperature degree in register 1:Thyst 2:Tos
 g [0~2] - get temperature in register 0:temperature 1:Thyst 2:Tos

Googling for thyst and tos gives quite a lot of hits among others
lm75a_1.pdf where they say on page 2: " set-point registers (Tos & Thyst) to store programmable  overtemp shutdown and hysteresis limits"

On my box g 1 always return 75 and g 2 always returns 80. I really hope nothing inside it is that hot wink

Offline

 

#13 2007-02-07 19:23:25

Paul
Member
From: Landshut, Germany
Registered: 2007-01-19
Posts: 35
Website

Re: Fan does run all the time :-(

is it really safe to run the unit at 60° ?? I read somewhere in the specs of my samsung hdds that 60°C should be upper limit ...

Offline

 

#14 2007-02-07 19:33:59

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

Lipovitan.B3 wrote:

is it really safe to run the unit at 60° ?? I read somewhere in the specs of my samsung hdds that 60°C should be upper limit ...

It is not meant to run at 60 degrees, I simply wanted to cap the maximum RPM so that the fan does not break, I have not tested fanspeed w 30000 to see if it's safe smile You can always use more conservative parameters... With the preceding parameters my unit has a temperature of 47-48 C under light load, which gives a fanspeed of 2400-2600. I should test and see what happens under a  heavier load. What temperatures do you other people have?

Last edited by galf (2007-02-07 19:34:34)

Offline

 

#15 2007-02-07 21:01:52

someguy
Member
Registered: 2007-01-17
Posts: 47

Re: Fan does run all the time :-(

galf wrote:

On my box g 1 always return 75 and g 2 always returns 80.

Cool. That would be consistent with the findings of the great .pdf file that you found (there's a lot of great information in it) - are you sure that chip is the one that's used in the dns-323?:
The .pdf you linked to contains this:
"Register Name:
Tos (Overtemp shutdown threshold Register) -- Default value = 80 degrees C. Contains two 8-bit data bytes.  To store the over-temp shut-down Tos limit.

Register Name:
Thyst - To store the hysteresis Thyst limit -- Default value = 75 degrees C. Contains two 8-bit data bytes. Read/Write."

I'm in the US, and my dlink reports "degrees F", my temperature values are currently:
g 1 = 167 (167 F = 75 C!), g 2 = 176 (176 F = 80 C!). 
This is consistent with your findings!

It appears you found the purpose of g 1 and g 2: "emergency shutdown" values by changing those registers!  A little fire protection, maybe : ). I don't want to test it, though : ).

PS: g 0 returns 107 F for me (but I just booted up) = (41.6 C), my fanspeed (I'm not using the script at the moment: fanspeed g 0: returns 2495 rpm.

Last edited by someguy (2007-02-07 21:10:33)

Offline

 

#16 2007-02-08 18:33:02

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

someguy wrote:

- one more thing:  we could also use a simple script to detect whether a system uses Farenheit or Celcius to store Temperature -- this way scripts could be more transportable (e.g: if someone writes a Script with Max temperatures at 176 Farenheit, but they run it on a Celcius-based machine... trouble!!)

The current version of the script might very well fail if the units are in Farenheit... It would be quite easy to fix though, I just need to add a parameter that defines the unit of T1 and T2. Then its a question of making sure all units match and convert if necessary.

Could anybody with a system that uses Farenheit post exactly what temperature g 0 reports?

Offline

 

#17 2007-02-08 18:51:57

cbrunnkvist
Member
From: Helsingborg, Sweden
Registered: 2007-01-20
Posts: 13

Re: Fan does run all the time :-(

ondro727 wrote:

Cut out "protective" piece of plastic from the back plate, enlarged the opening, added some padding.

I mentioned that I considered doing the same thing... And so I did, the other week. I did, however, not make any further modifications by using a file or rasp ( http://en.wikipedia.org/wiki/File_%28tool%29 ) but simply cut the plastic cover bit out. It didn't make it totally silent in any way, but at least lowered the idle swooosh:ing noise a bit.

I think I'll follow in ondro727's tracks soon, however... :-)

Offline

 

#18 2007-02-08 22:55:45

galf
Member
Registered: 2007-01-15
Posts: 8

Re: Fan does run all the time :-(

someguy wrote:

galf wrote:

On my box g 1 always return 75 and g 2 always returns 80.

Cool. That would be consistent with the findings of the great .pdf file that you found (there's a lot of great information in it) - are you sure that chip is the one that's used in the dns-323?:

Just to make it clear, I have no idea which chip is used in the dns-323. I simply assume that most of these chips are fairly similar and thus have certain standard features. I think it is safe to assume that the meaning of  temperature g 1 and 2 are those given in that pdf. Note that you can write values to these registers but not to g 0.

Offline

 

#19 2007-02-10 19:22:27

gotdiskey
Member
Registered: 2007-01-26
Posts: 17

Re: Fan does run all the time :-(

Here is a script to convert Fahrenheit to Celcius:

Code:

#!/bin/sh

# Converts Fahrenheit to Celcius
convert() {
  echo `echo $1|./busybox3 awk '{printf("%d", ($1-32) / 1.8)}'`
}

F=`temperature g 0 | grep Fahrenheit -c`
T=`temperature g 0 | ./sed -n ' s/<temperaturertc>: get temperature =//p'`

# Convert to Celcius if output is in Fahrenheit
if [ $F -gt 0 ]
then
  echo Farenheit: $T
  T=$(convert $T)
fi
echo Celcius: $T

I've also been looking for a way to get the status of the disks. The kernel (or the disks) I have does not support hdparm -C (check IDE power mode status), so the only way I know of right now is to check dmesg. At least in 1.02b they log disk status changes. Anyone got a better idea?

When using busybox3 (e.g. for sed) that resides on the disk, how do you know that the script won't spin up the disk?

And btw, about the script mentioned above, setting the fan speed to anything below allowed range (1935) will actually set it to 0. Dmesg will show "<Wrong rpm speed>".

/gotdiskey

Offline

 

#20 2007-02-15 03:15:16

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

I have problem running ctrl_fanspeed script sad It is caused by "missing" <sed> command. It looks to me, that there is no way I can run <sed> (streameditor) on DNS-323... How is that? You use this script without a problem, so what is wrong in my case?

When I try to run sed from within telnet (sed or ./sed), all I got is:

/mnt/HD_a2/lnx_bin/sh: ./sed: not found

sed doesn't seem to be listed anywhere in the system. Am I completely wrong or is there any other problem?

At the moment all I run is telnet (set up exactly as written in wiki - working without a problem), no other modifications, firmware rev. 1.02b. Any suggestions? smile

UPDATE: Well, I supposed that sed was a part of the system... Now I copied it manually (from the same archive as telnet files) to the disk and it is running fine. Sorry for that tongue At least if someone comes to this problem too... smile But some other question - would you update the script so it kills the original fancontroll at the start? Sorry I'm not any good in scripting, so parsing ps command for "fancontrol", obtaining pid and killing it by this pid is out of my reach sad

Last edited by ondro727 (2007-02-15 03:37:48)

Offline

 

#21 2007-02-15 06:56:55

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: Fan does run all the time :-(

ondro727 wrote:

UPDATE: ... But some other question - would you update the script so it kills the original fancontroll at the start? Sorry I'm not any good in scripting, so parsing ps command for "fancontrol", obtaining pid and killing it by this pid is out of my reach sad

I just came across this command which is useful to kill a process in a script on the DNS-323

#/bin/pidof

You call it with the argument of the name of a process and it returns the pid
You can add the following to the beginning of your script

Code:

#!/bin/sh

PID=$(/bin/pidof fancontrol)

if [ -n "$PID" ]
then
   kill -9 $PID
fi

//Mig


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

#22 2007-02-15 08:09:22

tobyg
Member
Registered: 2007-01-31
Posts: 42

Re: Fan does run all the time :-(

mig wrote:

ondro727 wrote:

UPDATE: ... But some other question - would you update the script so it kills the original fancontroll at the start? Sorry I'm not any good in scripting, so parsing ps command for "fancontrol", obtaining pid and killing it by this pid is out of my reach sad

I just came across this command which is useful to kill a process in a script on the DNS-323

#/bin/pidof

You call it with the argument of the name of a process and it returns the pid
You can add the following to the beginning of your script

Code:

#!/bin/sh

PID=$(/bin/pidof fancontrol)

if [ -n "$PID" ]
then
   kill -9 $PID
fi

//Mig

You can do it all on one line (it won't check if the PID is even there, it'll just try to kill it)

kill -9 `pidof fancontrol`

those are backwards ticks, on my keyboard it's the one above the 'tab' key.

Offline

 

#23 2007-02-16 00:44:19

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

@mig & tobyg: Thanx a lot smile

One more thing - it seems that while running ctrl_fanspeed, my DNS323 doesn't spin down the drives. Normally, even when running telnet deamon, power management funs fine. But as soon as I keep ctrl_fanspeed running in a background, drives never spin down... Anyone else noticed this? I will try to check it once more, but it seems to me it is just like I described sad

Other idea - when you balance T1 and T2 values and combine it with appropriate RPM settings, you may turn off the fan even when you can't get the state of the disks (sleep/running). While disks are powered down, my temperature is 44-45C, if the disks are running, temperature is >49C (reported by the system - the disk itself is only warm, so the temp. probe must be places somehow strangely or reporting higher temperatures than real values...). So if you set interval in script accordingly, you can turn off the fan in temperatures <47C (supposing the disks are powered down) by setting RPM<2000 (this turns off the fan). When temperature gets higher than 47C, RMP you get from the interpolation gets >2000, which actually starts the fan back. The only problem, why I can't test this, is that drives doesn't spin down when ctrl_fanspeed is running... Any ideas? tongue

UPDATE: This one seems to work. I tried to copy ctrl_fanspeed.sh script and sed binary from HDD to ram (ram disk) and run the script from there. This seems to solve disk power management problem. I know this is probably not universal (sed now occupies 168kB of memory), but since I do not use anything else (user) in the ram disk, seems that the system is running fine (still 2.6MB free on ram disk)... I modified fun_plug by adding:

cp /mnt/HD_a2/lnx_bin/sed /usr/sbin/
cp /mnt/HD_a2/ctrl_fanspeed.sh /usr/sbin
cd /usr/sbin
./ctrl_fanspeed.sh &

Runs fine for now. I'll be back with the update big_smile

Last edited by ondro727 (2007-02-16 03:49:01)

Offline

 

#24 2007-02-16 08:06:18

Apskaft
Member
From: Karlskrona, Sweden
Registered: 2007-01-09
Posts: 165

Re: Fan does run all the time :-(

I've said it before, but why don't you all get an inexpensive USB Key Drive(flash drive, €16/Gb) and put all your stuff there? Instructions to get it running are already in the wiki. The only thing you need on the HDD is a minimal fun_plug and the usb-storage.ko module.

/Apan

Offline

 

#25 2007-02-16 12:08:21

ondro727
Member
Registered: 2007-01-30
Posts: 19

Re: Fan does run all the time :-(

Looks now it might not be an issue with the ctrl_fanspeed thou... I was quick in judgement. It seems I just came upont the same problem as some of you described earlier - solution proposed was to remove printer queue (there were no jobs, I don't use printer on DNS323). I removed the folder, but then have to leave home. As soon as I am back, I'll try to put ctrl_fanspeed.sh and sed back to disk (remove entries in startup, copying them to ram disk) to check if they actually cause the spin ups.

Other thing I noticed is that in every check, even in the fan RPM is already 0, ctrl_fanspeed script causes the fan to spin up and then back down. Maybe setting RPM to 0, when it alreasy is 0 is causing this. The best way might be to modify the script, so when there is no need for RPM change (if already 0 and trying to keep it 0), it won't explicitly re-set it to 0. I'll try to figure out as soon as I am back to the unit. Will report tongue

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB