先日Debian sid amd64環境でapt upgradeしたときにhddtempのNEWSがあることに気づきました.

$ zcat /usr/share/doc/hddtemp/NEWS.Debian.gz
hddtemp (0.3-beta15-54) unstable; urgency=medium

  hddtemp has been dead upstream for many years and is therefore in a minimal
  maintenance mode. It will be shipped in the Debian Bullseye release, but
  will not be present in the Debian Bookworm release.

  Nowadays the 'drivetemp' kernel module is a better alternative. It uses the
  Linux Hardware Monitoring kernel API (hwmon), so the temperature is returned
  the same way and using the same tools as other sensors.

  Loading this module is as easy as creating a file in the /etc/modules-load.d

    echo drivetemp > /etc/modules-load.d/drivetemp.conf

 -- Aurelien Jarno <>  Tue, 02 Feb 2021 20:27:44 +0100


$ sudo hddtemp /dev/sda
/dev/sda: Seagate BarraCuda SSD ZA0100MC0100 2    : 41°C

しかしこのNEWSによると hddtemp はもう上流でメンテナンスされていないのでDebianの次期バージョンの Bullseye には入るけどその次の Bookworm からは除かれる予定のようです.

そして drivetemp というカーネルモジュールが代替になるとのこと.



例 1. zcat /usr/share/doc/linux-doc-5.10/Documentation/hwmon/drivetemp.rst.gz | rst2html | w3m -T text/html

Kernel driver drivetemp


ANS T13/1699-D Information technology – AT Attachment 8 – ATA/ATAPI Command Set

ANS Project T10/BSR INCITS 513 Information technology – SCSI Primary Commands –
4 (SPC-4)

ANS Project INCITS 557 Information technology – SCSI / ATA Translation – 5


This driver supports reporting the temperature of disk and solid state drives
with temperature sensors.

If supported, it uses the ATA SCT Command Transport feature to read the current
drive temperature and, if available, temperature limits as well as historic
minimum and maximum temperatures. If SCT Command Transport is not supported,
the driver uses SMART attributes to read the drive temperature.

Usage Note

Reading the drive temperature may reset the spin down timer on some drives.
This has been observed with WD120EFAX drives, but may be seen with other drives
as well. The same behavior is observed if the ‘hdtemp’ or ‘smartd’ tools are
used to access the drive. With the WD120EFAX drive, reading the drive
temperature using the drivetemp driver is still possible after it
transitioned to standby mode, and reading the drive temperature in this mode
will not cause the drive to change its mode (meaning the drive will not spin
up). It is unknown if other drives experience similar behavior.

A known workaround for WD120EFAX drives is to read the drive temperature at
intervals larger than twice the spin-down time. Otherwise affected drives will
never spin down.

Sysfs entries

Only the temp1_input attribute is always available. Other attributes are
available only if reported by the drive. All temperatures are reported in
milli-degrees Celsius.

│temp1_input │Current drive temperature │
│temp1_lcrit │Minimum temperature limit. Operating the device below this │
│ │temperature may cause physical damage to the device. │
│temp1_min │Minimum recommended continuous operating limit │
│temp1_max │Maximum recommended continuous operating temperature │
│temp1_crit │Maximum temperature limit. Operating the device above this │
│ │temperature may cause physical damage to the device. │
│temp1_lowest │Minimum temperature seen this power cycle │
│temp1_highest│Maximum temperature seen this power cycle │

drivetempを読み込むとSysfs で temp1_input として出てくるようです.

$ find /sys/ -name "temp1_input" > /tmp/before.list 2>/dev/null
$ cat /tmp/before.list
drivetemp モジュールの読み込み
$ sudo modprobe -v drivetemp
insmod /lib/modules/5.10.0-3-amd64/kernel/drivers/hwmon/drivetemp.ko
$ echo drivetemp | sudo tee /etc/modules-load.d/drivetemp.conf
$ find /sys/ -name "temp1_input" 2>/dev/null | diff -u /tmp/before.list -
--- /tmp/before.list    2021-02-05 01:45:58.691517588 +0900
+++ -   2021-02-05 01:46:00.178371154 +0900
@@ -1,3 +1,4 @@
$ cat /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/hwmon/hwmon6/temp1_input
$ sudo hddtemp /dev/sda
/dev/sda: Seagate BarraCuda SSD ZA0100MC0100 2    : 44°C

hddtemp と同じ結果が取得できました.同じなので drivetemp の値は摂氏のようですね :)



メールアドレスが公開されることはありません。 が付いている欄は必須項目です