LinuxCommandLibrary

hddtemp

Report hard drive temperatures

TLDR

Display temperature of a specific drive

$ hddtemp [type]:[/dev/sdX]
copy

Display temperature of a SATA drive assigned to sda
$ hddtemp SATA:/dev/sda
copy

Log temperatures to syslog every n seconds
$ hddtemp [[-S|--syslog]] [nseconds] [type]:[/dev/sdX]
copy

Print only numeric value of temperature without unit
$ hddtemp [[-n|--numeric]] [type]:[/dev/sdX]
copy

Define the unit used to denote temperature
$ hddtemp [[-u|--unit]] [C|F] [type]:[/dev/sdX]
copy

Wake ATA drive before attempting to read temperature
$ hddtemp [[-w|--wake-up]] [type]:[/dev/sdX]
copy

Enter debug mode to show S.M.A.R.T. fields and their values
$ hddtemp [[-D|--debug]] [type]:[/dev/sdX]
copy

Suppress compatibility check for drive types
$ hddtemp [[-q|--quiet]] [type]:[/dev/sdX]
copy

SYNOPSIS

hddtemp [options] [device(s)...]

PARAMETERS

-d, --daemon
    Runs hddtemp as a background daemon, continuously monitoring specified devices.

-w, --webserver
    Starts an HTTP web server, allowing temperature data to be viewed via a web browser. Implies --daemon.

-p , --port=
    Specifies the TCP port number for the daemon or web server (default is 7634).

-l

, --listen=

    Specifies the IP address to listen on for daemon/web server connections (default is all interfaces).

-n, --numeric
    Displays temperature in numeric form only, without the unit (e.g., '35' instead of '35°C').

-q, --quiet
    Suppresses headers and other non-temperature output, useful for scripting.

-u , --unit=
    Specifies the temperature unit: 'C' for Celsius (default) or 'F' for Fahrenheit.

-f , --file=
    Specifies an alternative configuration file.

-s, --status
    Shows the status of specified devices (e.g., if S.M.A.R.T. is supported and enabled).

-v, --version
    Displays the hddtemp version information.

-h, --help
    Shows a help message and exits.

DESCRIPTION

hddtemp is a command-line utility for Linux and Unix-like operating systems that reports the temperature of S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) enabled hard drives. It reads the temperature attribute directly from the drive's S.M.A.R.T. data, providing real-time information about its operational temperature. This is crucial for proactive system maintenance, as excessive heat can lead to premature drive failure and data loss.

hddtemp can be run in a single-shot mode to display the temperature of specified devices, or it can operate as a daemon, continuously monitoring temperatures and making this data available over a network port (HTTP or raw data) for logging, graphing applications, or other monitoring tools. It primarily supports various ATA/SATA hard drives and requires S.M.A.R.T. support to be enabled in the drive's firmware and, potentially, the system's BIOS.

CAVEATS

hddtemp relies on S.M.A.R.T. functionality, which must be enabled in the hard drive's firmware and potentially the system's BIOS/UEFI settings.

Not all hard drives, particularly older models or some specific vendors/interfaces (like some RAID controllers or NVMe SSDs), fully support reporting temperature via S.M.A.R.T. attributes that hddtemp can read. For NVMe devices, nvme-cli is typically used.

Running hddtemp often requires root privileges or appropriate kernel capabilities (CAP_SYS_RAWIO) to access raw S.M.A.R.T. data from the hard drive.

If running as a daemon, ensure proper firewall rules are in place if exposing the port to the network.

DAEMON MODE BENEFITS

When run as a daemon (-d or -w), hddtemp can continuously monitor drive temperatures in the background. This is invaluable for long-term health monitoring, allowing administrators to collect historical data for trending, set up alerts for high temperatures, or integrate with graphing solutions like RRDtool or Prometheus for performance and health visualization. It avoids the overhead of spawning a new process for each temperature check.

S.M.A.R.T. DEPENDENCE

hddtemp specifically leverages the S.M.A.R.T. interface of hard drives. If a drive does not support S.M.A.R.T., or if S.M.A.R.T. is disabled, hddtemp will be unable to retrieve temperature information. Users might need to consult their drive's documentation or the system's BIOS settings to ensure S.M.A.R.T. is active. This dependency means it's not a universal temperature sensor for all storage types.

HISTORY

hddtemp was originally written by Stuart M. Henderson and has been maintained by various contributors over the years. It has become a standard utility in many Linux distributions, providing a simple yet effective way to monitor hard drive temperatures, which is critical for preventing data loss and ensuring the longevity of storage devices. Its development has focused on supporting a wide range of ATA/SATA controllers and drives, adapting to evolving hardware standards.

SEE ALSO

smartctl(8), sensors(1), nvme-cli(1)

Copied to clipboard