20

Is there a way to monitor temperature or reads/writes of and NVMe drive (in this case Intel 750). hdparm, udisksctl, smartctl, and hddtemp all seem to lack this capability, google searches have been fruitless.

For the curious, this is the only difficulty I've faced running Fedora 23 (Workstation) using NVMe for the system drive.

Richard Border
  • 305
  • 1
  • 2
  • 10

4 Answers4

39

Using nvme-cli, I can get temperature from a Samsung 950 Pro with this command:

nvme smart-log /dev/nvme0 | grep "^temperature"

You can get other informations too:

nvme smart-log /dev/nvme0

Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 45 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 0%
data_units_read                     : 3,020,387
data_units_written                  : 2,330,810
host_read_commands                  : 26,960,077
host_write_commands                 : 15,668,236
controller_busy_time                : 65
power_cycles                        : 98
power_on_hours                      : 281
unsafe_shutdowns                    : 68
media_errors                        : 0
num_err_log_entries                 : 63
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0

Note: using kernel 4.6.4

For users access:

/etc/sudoers

# For users group
%users ALL = NOPASSWD: nvme smart-log /dev/nvme0 | grep "^temperature"

# For all
ALL ALL = NOPASSWD: nvme smart-log /dev/nvme0 | grep "^temperature"
zentoo
  • 539
  • 4
  • 5
6

With kernel 5.5 and beyond, temperature information is available to regular users via sysfs. For example, on my system:

/sys/class/nvme/nvme0/device/hwmon/hwmon1/name:nvme
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_alarm:0
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_crit:84850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_input:50850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_label:Composite
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_max:84850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp1_min:-273150
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp2_input:50850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp2_label:Sensor 1
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp2_max:65261850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp2_min:-273150
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp3_input:62850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp3_label:Sensor 2
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp3_max:65261850
/sys/class/nvme/nvme0/device/hwmon/hwmon1/temp3_min:-273150

The different temperatures are in the *_input files. The values are T(℃) * 1000. For example, the temperature from sensor 1 is ~51℃.

gobenji
  • 221
  • 3
  • 3
  • Hm, FWIW, on an Alder Lake system with `5.19.12-100.fc35.x86_64` and WD_BLACK SN850, there is no `/sys/class/nvme/nvme0/device/hwmon` directory. (the temperature does show up in in `nvme smart-log` though). However, there is `/sys/class/hwmon/hwmon3/name -> nvme` with `/sys/class/hwmon/hwmon3/temp1_input` that seems to match the smart-log number. – maxschlepzig Oct 03 '22 at 11:45
2

Here are some steps you can take. Ensure that your Linux kernel version is at least 3.19 and that you have the Intel Linux NVMe drivers installed. If that does not help consider installing the Linux NVMe command line interface.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
torchhound
  • 278
  • 2
  • 7
  • Unfortunately the nvme-cli does not appear to have the desired capabilities. And I'm running kernel 4.4.8 (I'm using the NVMe drive for my OS after all). – Richard Border May 02 '16 at 18:37
  • I can't think of anything else and Google isn't turning anything up so I guess you either need to do more in-depth research, wait for someone more knowledgeable to answer, or create your own solution. Sorry I couldn't be of greater assistance. – torchhound May 02 '16 at 21:16
0

This works for me, you may need to find which hwmon and temp for your system in /sys/devices/*

Using conky

${hwmon 2 temp 1}°C
AdminBee
  • 21,637
  • 21
  • 47
  • 71
Dennis
  • 1