In my home lab I’m running a Dell PowerEdge T630.
While the T630 is a very powerful machine for a home lab, the fans are just as powerful. Personally I prefer quiet – and I’m not concerned if CPU throttling is occuring.
Today I wrote a script to make it easier to control the fan speed with ipmitool
In order to use this script with your PowerEdge – you will need to enable IPMI in iDRAC
#!/bin/bash
# Function to display usage
usage() {
echo "Usage: $0 -h host [-l username] [-p password] [-p percentage]"
echo " -h host: IP address or hostname of the iDRAC (mandatory)"
echo " -l username: Username for IPMI authentication"
echo " -p password: Password for IPMI authentication"
echo " -p percentage: Percentage value (0-100) to set fan speed (default: 0)"
exit 1
}
# Check if ipmitool is installed
if ! command -v ipmitool &> /dev/null
then
echo "Error: ipmitool is not installed. Please install ipmitool to proceed."
exit 1
fi
# Initialize variables
username=""
password=""
host=""
percentage="0"
# Parse command-line options
while getopts "h:l:p:" opt
do
case $opt in
h) host="$OPTARG" ;;
l) username="$OPTARG" ;;
p)
if [[ "$OPTARG" =~ ^[0-9]+$ && "$OPTARG" -ge 0 && "$OPTARG" -le 100 ]]
then
percentage="$OPTARG"
else
echo "Error: Percentage value must be an integer between 0 and 100."
usage
fi
;;
\?) usage ;;
esac
done
# Check if mandatory -h option is provided
if [[ -z ${host} ]]
then
echo "Error: -h (host) option is mandatory."
usage
fi
# Prompt for username if not provided via getopts
if [[ -z ${username} ]]
then
echo -n "Enter username: "
read username
fi
# Prompt for password if not provided via getopts
if [[ -z ${password} ]]
then
echo -n "Enter password: "
read -s password
fi
# Disable automatic fan speed control
ipmitool -I lanplus -H "${host}" -U "${username}" -P "${password}" raw 0x30 0x30 0x01 0x00
# Set fan speed based on percentage
if [[ -n ${percentage} ]]
then
value=$(printf "%x\n" $((percentage * 64 / 100)))
ipmitool -I lanplus -H "${host}" -U "${username}" -P "${password}" raw 0x30 0x30 0x02 0xff 0x${value}
fi