Kevin Horton
Guru
- Joined
- Dec 2, 2015
- Messages
- 730
I don't have sufficient privileges to create a new thread in Hacking or Useful Scripts, so I'll post here.
My FreeNAS box (currently in hard drive badblocks testing) will be idle most of the time. The hard drive temperatures stay low with the case fans at low speed when the drives aren't being heavily used, but they climbed above 40 deg C when under constant use.
The following script uses ipmitool to set the fan speed on some SuperMicro boards to either Optimal or Full, depending on the hard drive temperatures. It works on my X10SL7-F board, and it should work on other X9 or X10 boards.
If any hard drive temperature is 40 deg C or higher, it sets the fan speed to Full. If all hard drives are 39 deg C or cooler, it sets the fan speed to Optimal. I set it as a cron job to run every five minutes.
Use at your own risk.
This script was further improved by @Stux in post #102 of this thread.
Neither @Stux nor I are still using this type of hard drive fan control. @Stux later developed a more complex and robust fan control script that handles CPU fan as well as hard drive fans. I modified that script to use a PID control loop for the hard drive fan control - that script was posted here.
My FreeNAS box (currently in hard drive badblocks testing) will be idle most of the time. The hard drive temperatures stay low with the case fans at low speed when the drives aren't being heavily used, but they climbed above 40 deg C when under constant use.
The following script uses ipmitool to set the fan speed on some SuperMicro boards to either Optimal or Full, depending on the hard drive temperatures. It works on my X10SL7-F board, and it should work on other X9 or X10 boards.
If any hard drive temperature is 40 deg C or higher, it sets the fan speed to Full. If all hard drives are 39 deg C or cooler, it sets the fan speed to Optimal. I set it as a cron job to run every five minutes.
Use at your own risk.
Code:
#!/usr/bin/perl # edit the following values as required $number_of_hard_drives = 5; $hd_designator = "/dev/da"; # edit nothing below this line $case = 0; foreach $item (0..$number_of_hard_drives-1) { $command = "/usr/local/sbin/smartctl -A $hd_designator$item | grep Temp"; # print "$command\n"; $output = `$command`; @vals = split(" ", $output); # grab last item from the output, which is the hard drive temperature $temp = "$vals[-1]\n"; # check for temperature greater than 39 deg C if ($temp > 39) { $case = 1; } } if ($case == 1) { # at least one hard drive is 40 deg C or higher # set fan speed control to Full `ipmitool raw 0x30 0x45 0x01 0x01` } else { # all hard drive temperatures are 39 deg C or cooler # set fan speed control to Optimal `ipmitool raw 0x30 0x45 0x01 0x02` }
This script was further improved by @Stux in post #102 of this thread.
Neither @Stux nor I are still using this type of hard drive fan control. @Stux later developed a more complex and robust fan control script that handles CPU fan as well as hard drive fans. I modified that script to use a PID control loop for the hard drive fan control - that script was posted here.
Last edited: