Marcio Cunha

How to monitor NVMe temperature on Linux via terminal

Learn how to extract telemetry from NVMe storage units on Linux using smartctl and nvme-cli. Prevent thermal throttling in high-performance servers.

Marcio Cunha•6 min
Also available in:PortuguêsEspañol
Summary
  • High-performance NVMe units generate intense heat under prolonged workloads and enter thermal throttling to prevent physical hardware damage.
  • The smartctl utility allows administrators to inspect basic SMART parameters and current thermal readings directly from the OS.
  • The nvme-cli tool provides advanced access to NVMe-specific protocol registers, including critical temperature limits and hardware alarms.
  • Continuous Bash monitoring scripts help log warnings to the system syslog before server application performance suffers severe degradation.
  • Proper cabinet airflow and robust passive heatsinks serve as vital complements to software telemetry in mission-critical server deployments.

Why excessive heat destroys your NVMe performance

Modern storage drives based on the NVMe protocol (Non-Volatile Memory Express, a high-speed interface connected directly to the PCI Express bus) deliver impressive read and write speeds. However, all that performance comes at a steep thermal cost. When subjected to intense server workloads, such as heavy database queries or continuous code compilation, these components heat up rapidly. If the temperature exceeds the safe limit specified by the manufacturer, the drive controller triggers a mechanism known as thermal throttling. In practice, this means the SSD drastically reduces its operating speed to cool down the NAND flash memory chips, causing invisible bottlenecks in the operating system that directly impact end users.

To prevent this scenario from degrading infrastructure stability, system administrators must adopt a rigorous hardware monitoring routine. In production Linux environments where graphical access is often absent, the terminal becomes the primary diagnostic tool. Monitoring NVMe temperature goes far beyond a simple preventive caprice; it is an essential engineering strategy to anticipate catastrophic failures and ensure predictable computing output. Before applying any physical remediation, such as replacing thermal pads or adjusting fans, you need to know exactly which metrics to extract from the system. If you also deal with board-level hardware diagnostics, it is worth checking our guide on how to test zener diodes on board with a digital multimeter to understand how electrical fault isolation complements storage telemetry.

Installing essential telemetry tools on Linux

Before we begin extracting thermal data from storage units, we need to ensure the proper utilities are installed on the operating system. In the Linux ecosystem, two tools reign supreme when it comes to high-performance disk diagnostics: smartctl, which is part of the smartmontools package, and nvme-cli, developed specifically to interact with the kernel's NVMe subsystem. smartctl acts as a traditional Swiss Army knife for SMART technology (Self-Monitoring, Analysis, and Reporting Technology, the embedded system reporting internal drive health), while nvme-cli exploits proprietary low-level commands from manufacturers.

The installation of these packages varies slightly depending on the Linux distribution used on your servers. In Debian or Ubuntu-based environments, the apt package manager resolves the dependency quickly. On Red Hat-based distributions such as Rocky Linux or AlmaLinux, we use dnf. In practice, executing these commands requires administrative privileges because the tools communicate directly with kernel registers and hardware controllers. It is recommended to keep these utilities updated to ensure full support for the latest features introduced in modern NVMe specifications.

How to extract temperature using the smartctl utility

smartctl is the quickest way to check the current temperature of an NVMe disk without memorizing complex syntaxes. To query the health status and temperature of a specific unit, normally identified as /dev/nvme0, we run the command with the information listing parameter. In practice, the output displays a series of technical data about the manufacturer, serial number, and, crucially for our goal, the field dedicated to the current temperature in degrees Celsius.

To perform this query cleanly in the terminal, we use the command with the SMART data reading flag. Check the practical execution example below:

sudo smartctl -A /dev/nvme0

When analyzing the output of this command, look for the line indicating Temperature or Temperature Sensor. Unlike traditional mechanical hard drives or older SATA SSDs that feature only a single sensor, modern NVMe SSDs usually come with multiple internal thermal sensors—one monitoring the main controller, which heats up significantly due to intense data processing, and others monitoring the flash memory chips. Observing the controller temperature is the secret to identifying chassis airflow failures before the rest of the motherboard is affected.

Exploring advanced features with the nvme-cli package

Although smartctl is excellent for quick checks, the nvme-cli utility offers a much higher level of detail because it was designed natively for the NVMe protocol. It allows you to access controller health log registers directly, displaying critical temperature limits set by the manufacturer. When the drive reaches the warning threshold configured in firmware, the device itself triggers internal alerts that can be captured by this utility.

To list all NVMe units recognized by the Linux kernel and extract an immediate overview of their thermal behavior, we run the primary subsystem listing command. See the corresponding instruction below:

sudo nvme list

To dive into the detailed thermal particulars of the disk, we use the specific controller health log command. This command returns a detailed report containing remaining life consumption, read/write errors, and current temperatures for all available sensors. Execute the command below to view this complete report:

sudo nvme smart-log /dev/nvme0

In practice, the temperature field displayed by this command shows exactly the value the operating system is seeing in real-time. If the reported value is dangerously close to the Warning Composite Temperature limit listed in the same report, the administrator has a clear window of time to mitigate the problem before application performance drops drastically due to thermal throttling.

Automating thermal alerts with Bash scripts

Manually monitoring NVMe temperature through the terminal is useful for point-in-time diagnostics, but in production environments with dozens of servers, automation is mandatory. We can create a small Bash script that periodically queries thermal sensors and sends an alert to the administrator or records a critical event in the system log if the temperature exceeds a predetermined threshold, such as 70 degrees Celsius.

The script below uses the nvme utility alongside basic text processing commands to extract only the numerical temperature value and compare it against the safe limit established by the operations team. Copy and adapt the code for your monitoring environment:

#!/bin/bash
DEVICE="/dev/nvme0"
MAX_TEMP=70

# Extract current temperature using nvme-cli
CURRENT_TEMP=$(sudo nvme smart-log $DEVICE | grep "temperature" | awk '{print $3}')

if [ "$CURRENT_TEMP" -ge "$MAX_TEMP" ]; then
  echo "ALERT: Drive $DEVICE reached ${CURRENT_TEMP}C! Risk of thermal throttling."
  # Here you can integrate with systemd-logger or chat tools
else
  echo "OK: Drive $DEVICE is operating at a safe temperature (${CURRENT_TEMP}C)."
fi

Configuring this script to run every five minutes via the system task scheduler ensures a highly efficient passive safety net. This way, temperature spikes caused by fan failures or dust buildup are detected immediately, allowing fast human intervention before data corruption or forced server shutdown occurs.

Final thoughts on cooling and storage longevity

Constant thermal monitoring of NVMe units on Linux via terminal is an indispensable practice for any infrastructure engineer who values server stability and high performance. The combined use of traditional tools like smartctl and modern utilities like nvme-cli empowers the technical team to look beyond superficial CPU and memory metrics, focusing directly on the health of the storage subsystem. As discussed, keeping temperature under control prevents dreaded thermal throttling and extends the lifespan of NAND flash components.

Ultimately, fast storage technology demands respect for the laws of thermodynamics. Investing time in setting up alert scripts, ensuring proper airflow in the server chassis, and using good-quality heatsinks are design decisions that pay for themselves by preventing outages during critical hours. With mastery of these commands in the Linux terminal, your operation gains a robust degree of operational maturity resilient against unexpected thermal surprises.