Thursday, January 26, 2017

Reading Samsung SSDs temperature using hddtemp tool

Hddtemp is a very simple tool that queries SMART-capable memory drives for temperature values. A quick note: SMART is a technology that lets you monitor stats about the health of disk. Each parameter has a code and an associated value. Software queries for a specific code and gets the corresponding value. Seems easy, right?

Now, hddtemp is pretty simple to use too. assuming your drive is /dev/sda:

#installation on debian-based systems
sudo apt install hddtemp

#usage
sudo hddtemp /dev/sda

If you get an error instead of just the name of your device and the temperature, there are two possible explanations:
  • The drive hasn't a temperature sensor onboard (never say never)
  • The drive doesn't provide temp value on SMART parameter 194.

In SMART, 194 is the code for "Current internal temperature". hddtemp checks parameter 194, unless an alternative code to check for that specific device is known. Those cases are handled by the hddtemp.db, that on Ubuntu is found under /etc/hddtemp.db . 

For SSDs, (at least Samsung ones), the correct smart code to check is 190 (or "Air flow temperature"). So we need a way to tell hddtemp that we know the right code in order to read temperature. 

Run:

sudo gedit /etc/hddtemp.db

Look at the file structure: 4 columns indicate a regex for matching with devices, a code, a 'C' character and an alias. We need to add a line for our Samsung SSD (850 Evo exposes temperature on parameter 190, but maybe your drive uses another code: Google is your friend then!):

#add this line at the bottom of the file, or in the SAMSUNG section for consistency
"SAMSUNG SSD 850 EVO" 190 C "Samsung SSD 850 EVO"

Then, save and close. You don't need to reboot in order to check if now hddtemp works well with your drive, it worked for me.

Some bottom notes: hddtemp is a non-gnu, gpl project hosted on Savannah repo. It is currently quite unmaintained, and it is packed in the repos of most known distributions with very old hddtemp.db, although on internet you can find more up-to-date version of this simple file. You can search or create your updated hddtemp.db and replace the old one in /etc folder if you want.

No comments:

Post a Comment