Hdd Temperature

There are a couple of ways to check the temperature of your HDDs in Linux. A popular option was hddtemp utility, but unfortunately, hddtemp has been removed from the official Ubuntu repositories since Ubuntu 22.04 (Jammy Jellyfish) and later versions.

Since hddtemp is no longer available, here is two simple alternative approaches:

1) Using lm-sensors and drivetemp kernel module:

This is the recommended approach for Ubuntu 22.04 and later.

Install lm-sensors using:

sudo apt update && sudo apt install lm-sensors

The drivetemp kernel module might not be loaded by default. You can check with:

sudo sensors

If there’s no output, load the drivetemp module with:

sudo modprobe drivetemp

Now, running sensors should display your HDD/SCSI/NVME temperatures along with other sensor data.

sudo sensors

To filter the results more precisely, use a command similar to the following, but modified according to your preferences

sudo sensors | grep -A 2 'scsi' | grep temp

but in my case I had to modify the order to include nvme as well:

sudo sensors | grep -A 2 'drive\|nvme' | grep 'drive\|nvme\|°C'

Command Breakdown:

sudo sensors: Retrieves sensor data from your system.
grep -A 2 'drive\|nvme': Filters the output using grep with two parts:
-A 2: Captures the matching line (containing “drive” or “nvme”) and two additional lines after it. This ensures we get the temperature data (temp1 for HDDs).
'drive\|nvme': This pattern searches for lines containing either “drive” (for HDDs) or “nvme” (for NVMe drives). The pipe symbol (|) acts as an OR operator, matching lines with either term.
grep 'drive\|nvme\|°C': Further filters the output:
'drive\|nvme': Ensures only lines relevant to drives (“drive” or “nvme”) remain.
°C: Filters for lines containing the temperature unit “°C”. This helps eliminate potentially irrelevant lines from the sensor data.

 

2) Using smartctl (limited functionality):

While not ideal for just temperature, smartctl can be used for some basic HDD health monitoring. Install it with:

sudo apt update && sudo apt install smartmontools

You can then use sudo smartctl -A /dev/sdX (replace /dev/sdX with your actual HDD device name) to get some S.M.A.R.T. information, which might include temperature data for some HDD models.

sudo smartctl -a /dev/sda | grep "Temperature"

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *