🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

smartctl Command

Intermediate Disk & Storage man(8)

Monitor disk health with SMART data

📅 Updated: Mar 16, 2026
SYNTAX
smartctl [OPTIONS] DEVICE

What Does smartctl Do?

The smartctl command reads SMART (Self-Monitoring, Analysis, and Reporting Technology) data from hard drives and SSDs. SMART is a monitoring system built into most modern storage devices that tracks drive health indicators like temperature, read errors, reallocated sectors, power-on hours, and wear leveling.

smartctl is part of the smartmontools package and is the primary tool for proactive disk failure detection. By monitoring SMART attributes, system administrators can identify drives that are degrading and replace them before they fail completely — preventing data loss and unplanned downtime.

Regular SMART monitoring is a critical part of server maintenance. Studies by Google and Backblaze have shown that certain SMART attributes (Reallocated Sector Count, Current Pending Sector, and Uncorrectable Sector Count) are strong predictors of imminent drive failure. smartctl allows you to check these attributes on demand or schedule automated tests.

Options & Flags

OptionDescriptionExample
-i Show drive identity and basic info sudo smartctl -i /dev/sda
-H Check overall health status (PASSED/FAILED) sudo smartctl -H /dev/sda
-A Show all SMART attributes sudo smartctl -A /dev/sda
-a Show all SMART information (combines -i, -H, -A) sudo smartctl -a /dev/sda
-t short Run a short self-test (~2 minutes) sudo smartctl -t short /dev/sda
-t long Run a long/extended self-test (hours) sudo smartctl -t long /dev/sda
-l selftest Show self-test log/results sudo smartctl -l selftest /dev/sda
-l error Show error log sudo smartctl -l error /dev/sda
-d TYPE Specify device type (sat, nvme, scsi, megaraid) sudo smartctl -a -d nvme /dev/nvme0
--scan Scan for devices and their types sudo smartctl --scan

Practical Examples

#1 Quick health check

Check overall health status. Returns PASSED or FAILED.
$ sudo smartctl -H /dev/sda
Output: SMART overall-health self-assessment test result: PASSED

#2 View all SMART attributes

Display all SMART attributes including temperature, power-on hours, reallocated sectors, and error rates.
$ sudo smartctl -A /dev/sda

#3 Full drive information

Complete SMART report: identity, health, attributes, error log, and self-test history.
$ sudo smartctl -a /dev/sda

#4 Check NVMe SSD

NVMe drives report different attributes: temperature, available spare, percentage used, data read/written.
$ sudo smartctl -a /dev/nvme0

#5 Run short self-test

Start a short self-test (~2 min), wait, then check results.
$ sudo smartctl -t short /dev/sda && sleep 120 && sudo smartctl -l selftest /dev/sda

#6 Check SSD wear level

Check SSD wear leveling — how much of its write endurance has been consumed.
$ sudo smartctl -A /dev/sda | grep -i "wear\|life\|used"

#7 Monitor critical attributes

Check the most important failure-prediction attributes. Non-zero Reallocated or Pending sectors indicate degradation.
$ sudo smartctl -A /dev/sda | grep -E "Reallocated|Pending|Uncorrectable|Temperature"

Tips & Best Practices

Replace on Reallocated Sectors: If Reallocated_Sector_Ct (ID 5) is non-zero and increasing, the drive is actively failing. Plan replacement immediately and backup all data.
Automate with smartd: Enable the smartd daemon for continuous monitoring. Configure /etc/smartd.conf to run periodic tests and email alerts on attribute changes.
Power-On Hours: Enterprise HDDs are rated for ~50,000 power-on hours (~5.7 years 24/7). Consumer drives for ~20,000-30,000 hours. Check attribute 9 (Power_On_Hours) for drive age.
Install smartmontools: Install with: apt install smartmontools (Debian/Ubuntu), dnf install smartmontools (Fedora/RHEL). Includes both smartctl and the smartd daemon.

Frequently Asked Questions

How do I check if my hard drive is failing?
Run sudo smartctl -H /dev/sda for a quick PASSED/FAILED check. Then check sudo smartctl -A /dev/sda for Reallocated Sector Count, Current Pending Sector, and Uncorrectable Sector Count — non-zero values indicate problems.
How do I check SSD health/wear?
For SATA SSDs: sudo smartctl -A /dev/sda | grep -i wear. For NVMe: sudo smartctl -a /dev/nvme0 and check Percentage Used. 100% means the drive has exceeded its rated endurance.
What SMART attributes predict failure?
The three most critical: Reallocated Sector Count (5), Current Pending Sector (197), and Uncorrectable Sector Count (198). Non-zero values, especially if increasing, indicate imminent failure.
Does smartctl work with NVMe drives?
Yes. smartctl auto-detects NVMe drives: sudo smartctl -a /dev/nvme0. NVMe reports different attributes including Available Spare, Percentage Used, and Critical Warning flags.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →