Temperature Monitoring on Linux
PhotoStructure monitors hardware temperatures on Linux and will automatically
pause the sync process when any sensor exceeds the
maxTempCelsius threshold (default:
80°C / 176°F). This prevents hardware damage from sustained high
temperatures during CPU-intensive operations like image hashing and video
transcoding.
PhotoStructure reads temperatures from three sources, and merges the results:
- lm-sensors — the standard Linux sensor monitoring package
- hwmon sysfs — direct kernel sensor readings from
/sys/class/hwmon/ - thermal zones — ACPI and platform thermal data from
/sys/class/thermal/
No root access is required for any of these methods.
lm-sensors
lm-sensors is the most full-featured option. It provides calibrated readings, human-readable sensor labels, and supports a wide range of hardware.
Installation
On Debian/Ubuntu:
sudo apt install lm-sensors
sudo sensors-detect
On Fedora/RHEL:
sudo dnf install lm_sensors
sudo sensors-detect
On Arch Linux:
sudo pacman -S lm_sensors
sudo sensors-detect
The sensors-detect command
scans your hardware and configures the appropriate kernel modules. Answer
“yes” to its prompts to load the detected modules.
After setup, verify it’s working:
sensors
You should see output listing your CPU, motherboard, and other sensor temperatures.
References
hwmon sysfs
The Linux kernel exposes hardware sensor data directly through the
hwmon sysfs interface
at /sys/class/hwmon/. PhotoStructure reads these files directly, so
temperature monitoring works even without lm-sensors installed.
This is especially useful in Docker containers and minimal Linux installs where installing additional packages may not be desirable.
Each sensor chip gets a directory like /sys/class/hwmon/hwmon0/ containing:
name— the kernel driver name (e.g.,k10temp,nct6798,nvme)temp1_input,temp2_input, … — temperatures in millidegrees Celsius
PhotoStructure automatically reads all available hwmon sensors. If lm-sensors is also installed, PhotoStructure deduplicates results so you don’t see the same sensor twice.
Docker
For Docker containers, you may need to bind-mount the hwmon sysfs directory:
volumes:
- /sys/class/hwmon:/sys/class/hwmon:ro
NVMe drives
NVMe SSDs typically expose their temperatures through hwmon automatically via the kernel’s NVMe driver, with no additional configuration needed.
References
Thermal zones
The Linux kernel’s
thermal framework
exposes temperature data at /sys/class/thermal/thermal_zone*/. This
interface is commonly used by:
- ACPI thermal zones on x86 systems (type:
acpitz) - Realtek SoCs in some Synology NAS models
- ARM platforms like Raspberry Pi
Each thermal zone directory contains:
type— a label likeacpitz,x86_pkg_temp, orcpu-thermaltemp— the current temperature in millidegrees Celsius
PhotoStructure reads all available thermal zones automatically.
Docker
For Docker containers, bind-mount the thermal sysfs directory:
volumes:
- /sys/class/thermal:/sys/class/thermal:ro
References
SATA/SAS drive temperatures
SATA and SAS hard drives report their temperatures through
S.M.A.R.T.
monitoring. On Linux, the
drivetemp
kernel module exposes these temperatures through the hwmon sysfs interface,
making them readable without root access.
Enabling drivetemp
Load the module:
sudo modprobe drivetemp
To load it automatically on boot, create a module configuration file (see
modules-load.d(5)):
echo drivetemp | sudo tee /etc/modules-load.d/drivetemp.conf
Verify it’s working:
# Look for drivetemp entries in hwmon
for h in /sys/class/hwmon/hwmon*; do
name=$(cat "$h/name" 2>/dev/null)
if [ "$name" = "drivetemp" ]; then
temp=$(cat "$h/temp1_input" 2>/dev/null)
echo "$h: ${temp%???}.${temp: -3}°C"
fi
done
Why not smartctl?
The traditional tool for reading drive temperatures is
smartctl, but it
requires root access
to query SATA/SCSI devices. The drivetemp kernel module provides the same
temperature data through hwmon sysfs files that are readable by any user.
Docker
For Docker containers, the drivetemp module must be loaded on the host
(not inside the container), and /sys/class/hwmon must be bind-mounted as
described above.
Synology NAS
Synology DSM may already expose drive temperatures through hwmon. If not, you can load the module via SSH:
sudo modprobe drivetemp
Note that Synology DSM may reset loaded modules after a reboot or DSM update. You may need to use a scheduled task to re-load the module on boot.
References
PhotoStructure settings
maxTempCelsius
The temperature threshold at which PhotoStructure pauses sync. Default:
80°C (176°F). Set to 0 to disable temperature monitoring.
excludedSensorNames
A list of glob patterns for sensor names to ignore. Default:
["*calibration*", "*fan*"]. Useful for filtering out sensors that report
incorrect or irrelevant readings.
See advanced settings for how to configure these values.
