我想在不安装hddtemp或smartctl的情况下检查硬盘驱动器的温度。是否有一种标准的UNIX方法来做到这一点?
例如,要检查不需要安装lm-sensors的CPU温度,只需读取/sys/class/thermal/thermal_zone*/temp或/sys/devices/platform/coretemp.0/hwmon/hwmon*/temp*_input即可。lm-sensors只是漂亮的印出来了。所以应该有一个hdd温度的文件。我试图在/sys/class/scsi_host文件夹中查找hdd温度文件,但什么也找不到。
发布于 2020-11-01 13:27:50
在linux上,5.6+使用驱动模块读取磁盘、传感器和数据。
加载模块驱动程序:
sudo modprobe drivetemp然后,您可以在/sys/class/hwmon/hwmon*/和其他传感器中找到传感器数据。
https://www.kernel.org/doc/html/latest/hwmon/drivetemp.html
示例列出所有驱动器:
grep -l "drivetemp" /sys/class/hwmon/hwmon*/name | while read f;
do printf "%s(%-.2s°C)\n" "`<${f%/*}/device/model`" "`<${f%/*}/temp1_input`";
done示例按模型列出驱动器:
grep -l "Lexar 256GB SSD" /sys/class/scsi_disk/*/device/model | while read f;
do printf "%s(%-.2s°C)\n" "`<${f%}`" "`<${f%/*}/hwmon/hwmon*/temp1_input`";
done示例仅获得驱动器模型的临时值:
cat "$(grep -l "Lexar 256GB SSD" /sys/class/scsi_disk/*/device/model | xargs dirname)"/hwmon/hwmon*/temp1_input列出驱动器模型的示例:
cat /sys/class/scsi_disk/*/device/modelhttps://unix.stackexchange.com/questions/558112
复制相似问题