smartctl (SMART control) — Disk SMART health checks
Linux / File and disk management / smartctl.html
A tool that reads SMART attributes and self-test results to detect early disk failures.
Basic Information
| Command Name | smartctl (SMART control) |
|---|---|
| One-line Introduction | A tool that reads SMART attributes and self-test results to detect early disk failures. |
| Provided by | smartmontools |
| Official Documentation | https://man7.org/linux/man-pages/man8/smartctl.8.html |
| Supported Operating Systems | Linux, macOS, Windows |
| Installation Status | Requires the smartmontools package |
| Category | Linux file and disk management (tags: SMART, disk, health check, smartmontools) |
What is this command?
smartctl reads the SMART values a disk records itself and reports reallocated sectors, pending sectors, temperature and power-on hours. It supports both HDDs and NVMe SSDs.
Checking -H and -a regularly helps you replace a disk before a sudden failure. NVMe devices need the -d nvme option.
What problems does it solve?
- You want early warning of a failing disk
- You are reviewing disk temperature and power-on hours
- You want to run and record a self-test
- You need to decide which disk to replace
Key features
Health summary
-H prints a short PASSED or FAILED verdict.
- When to use: You need a quick verdict
- What you get: The disk's own verdict
- Limitations: PASSED does not reveal a worsening individual attribute.
Full attribute view
-a shows the attribute table, error log and self-test history.
- When to use: You need detailed diagnostics
- What you get: Reallocated and pending sectors, temperature, error log
- Limitations: Attribute names differ slightly between vendors.
Run a self-test
-t short or -t long starts an internal self-test.
- When to use: Your maintenance routine includes a diagnostic
- What you get: Test progress and result log
- Limitations: A long test takes hours and adds load.
Installation and usage
Check whether it is installed
smartctl --version
sudo apt install smartmontools # Debian/Ubuntu sudo dnf install smartmontools # Fedora
Real-world examples
Check health
Show only the SMART verdict.
sudo smartctl -H /dev/sda
Attributes and error log
Print attributes and recent error records.
sudo smartctl -a /dev/sda
Short self-test
Start a short test and read the result from the log.
sudo smartctl -t short /dev/sda
sudo smartctl -l selftest /dev/sda