Basic fan control for the Asustor Lockerstor Gen2 in TrueNAS

With the warmer months coming up, I started to worry about the low fixed speed of the built-in fan of my Asustor Lockerstor Gen2 NAS running TrueNAS. When using the default Asustor software, there’s a userspace daemon that presumably monitors temperatures of the CPU and drives and adjusts the fan speed accordingly. However, there is no such fan control mechanism by default in TrueNAS.