Check SMART Status In Linux: Don't Skip This Step
- 01. Check SMART Status in Linux: Don't Skip This Step
- 02. What SMART Means for Linux Systems
- 03. Installing and Enabling SMART Tools
- 04. Listing and Identifying Drives
- 05. Basic SMART Health Check Commands
- 06. Interpreting Full SMART Attribute Output
- 07. Running Short and Long Self-Tests
- 08. Configuring Continuous SMART Monitoring
- 09. Handling Non-Standard Interfaces and Enclosures
- 10. Sample Script to Automate SMART Checks
Check SMART Status in Linux: Don't Skip This Step
To check SMART status in Linux, install the smartmontools package, then run sudo smartctl -H /dev/sdX (where sdX is your drive) to see a pass/fail health report; you can also run sudo smartctl -a /dev/sdX to view full SMART attributes, including temperature, reallocated sectors, and error counts, which are critical early indicators of drive failure. This is the fastest, most reliable method for any modern Linux desktop or server, and it applies equally to SATA, NVMe, and SCSI drives when used with the appropriate interface flags.
What SMART Means for Linux Systems
SMART (Self-Monitoring, Analysis, and Reporting Technology) is a hardware feature built into most hard drives and SSDs that periodically logs internal metrics such as read/write errors, spin-up time, reallocations, and power-on hours. On Linux, these metrics are exposed via the smartctl utility, which wraps vendor-specific ATA, SCSI, or NVMe commands into a single, portable interface.
By the middle of 2025, roughly 87% of dedicated Linux servers in European and North American data centers were running some flavor of continuous SMART monitoring, according to a joint survey by WorldStream and WafaTech. In that sample, 64% of hardware-related outages were preceded by at least one drive showing a "Reallocated_Sector_Count" or "Offline_Uncorrectable" warning in SMART data more than 48 hours before complete failure.
Installing and Enabling SMART Tools
Before you can check SMART status, you must install the smartmontools suite, which provides both the command-line smartctl and the background daemon smartd for continuous monitoring. Most distributions ship this package in their main repositories, so the exact command varies by distro but follows a consistent pattern.
- Debian/Ubuntu:
sudo apt update && sudo apt install smartmontools - CentOS/RHEL/AlmaLinux:
sudo yum install smartmontoolsorsudo dnf install smartmontools - Fedora:
sudo dnf install smartmontools - openSUSE:
sudo zypper install smartmontools
Once the package is installed, verify that the smartd daemon is not masked or disabled by running sudo systemctl status smartd; if it shows as inactive, enable it with sudo systemctl enable --now smartd. Enabling the daemon allows the system to periodically poll each drive's SMART attributes and send email alerts if any critical attribute exceeds configurable thresholds.
Listing and Identifying Drives
Before checking a specific drive, you must determine which device node corresponds to the physical disk or SSD. The most reliable way to list all block devices is to use either lsblk or sudo fdisk -l, both of which output a clear mapping between device names (like /dev/sda or /dev/nvme0n1) and their partitions.
- Run
lsblkto see a tree-style view of all block devices and their mount points. - Identify the root device (often
/dev/sdaor/dev/nvme0n1) or any data drives you want to inspect. - Confirm the device name in the
NAMEcolumn and note its size and model string. - Optionally, scan for all SMART-capable devices with
sudo smartctl --scan. - Take the device path (for example,
/dev/sda) and pass it to all subsequentsmartctlcommands.
Basic SMART Health Check Commands
The simplest way to check SMART status is to run a quick health query that returns a binary pass/fail verdict. This is useful both for ad-hoc checks and for scripts that must parse a deterministic success or failure state.
Run sudo smartctl -H /dev/sdX, replacing sdX with your actual device (e.g., /dev/sdb), to see the drive's self-assessed health; if the output says SMART overall-assessment test result: PASSED, the drive reports no critical issues. If it reports FAILED or FAILURE PREDICTED, the drive has flagged one or more attributes that strongly suggest impending hardware failure.
Interpreting Full SMART Attribute Output
For a deeper analysis, use sudo smartctl -a /dev/sdX to dump the full SMART table, which includes dozens of vendor-specific attributes such as Temperature_Celsius, Power_On_Hours, Reallocated_Sector_Count, and Current_Pending_Sector. These raw numbers, when trended over time, provide the most accurate early warning of drive degradation.
| SMART Attribute | What It Means | Typical "Warning" Threshold |
|---|---|---|
Reallocated_Sector_Count |
Number of sectors moved from failing locations to spare areas on the disk. | Any value > 0 indicates potential mechanical wear. |
Current_Pending_Sector |
Sectors waiting to be remapped; may soon become reallocated. | Non-zero values suggest active read/write unreliability. |
Offline_Uncorrectable |
Blocks that the drive cannot correct even after retrying. | Values above 0 often precede outright drive failure. |
Temperature_Celsius |
Current temperature of the drive in degrees. | Long-term operation above 40-45°C may reduce lifespan. |
Power_On_Hours |
Total hours the drive has been powered on. | Higher values correlate with increased mechanical wear. |
When reviewing this output, pay particular attention to attributes marked WHEN_FAILED or FAILING_NOW in the "Raw_Read_Error_Rate" or "Reallocated_Sector_Count" lines; these are among the strongest predictors of imminent drive failure.
Running Short and Long Self-Tests
In addition to inspecting static attributes, you can invoke the drive's built-in self-test routines to actively probe for problems. These tests are non-destructive and can be scheduled during maintenance windows without downtime.
- Ensure the drive supports self-tests by running
sudo smartctl -c /dev/sdXand confirming that "Self-test supported" appears under Offline data collection. - Start a short self-test (usually 2-5 minutes) with
sudo smartctl -t short /dev/sdX. - Wait for the test to finish, then check the results with
sudo smartctl -l selftest /dev/sdX. - For a more thorough examination, launch a long self-test with
sudo smartctl -t long /dev/sdX, which can take several hours depending on capacity and interface. - Re-run the self-test log query to confirm the test completed without errors.
In a 2025 internal study of 1,200 Linux servers, 41% of drives that failed within the next 30 days had reported at least one failed self-test in the preceding week, often flagged by Aborted, Interrupted, or Failed entries in the self-test log.
Configuring Continuous SMART Monitoring
For production Linux servers, it is best practice to configure smartd to poll drives continuously and send email alerts when critical thresholds are crossed. This setup turns SMART data into an operational monitoring signal rather than a one-off diagnostic tool.
To configure continuous monitoring, edit /etc/smartd.conf in your preferred text editor (for example, sudo nano /etc/smartd.conf) and add lines for each device you want to supervise. A typical entry for a SATA drive looks like /dev/sda -a -m root -M exec /usr/share/smartmontools/smartd-runner, where -a enables all SMART tests and -m root routes alert emails to the root user.
After saving the configuration file, restart the daemon with sudo systemctl restart smartd and verify that the service is running cleanly via sudo systemctl status smartd. Once active, smartd will log periodic summaries and send alerts whenever a drive reports a "Reallocated_Sector_Count" spike, "Offline_Uncorrectable" entries, or any other attribute that crosses the built-in vendor thresholds.
Handling Non-Standard Interfaces and Enclosures
Some USB-attached drives, NVMe enclosures, or RAID-backed disks may not respond directly to generic SMART commands because they tunnel ATA/SCSI/NVMe traffic over additional protocol layers. In these cases, you must specify an explicit drive type with the -d flag so that smartctl emits the correct low-level commands.
Common interface types include ata (for standard SATA), scsi (for SCSI and many USB-SATA bridges), and sat (for SATA-over-USB enclosures). For example, a USB-connected SATA drive might require sudo smartctl -d sat -H /dev/sdb to yield a valid SMART status.
If the default interfaces do not work, modern smartmontools builds (7.2 and later) include additional probing modes and experimental support for USB-NVMe bridges, which can be invoked via nightly build binaries downloadable from the official smartmontools nightly builds page. These builds are especially useful for diagnosing NVMe drives in USB-C enclosures that may not expose SMART data through stock distro packages.
Sample Script to Automate SMART Checks
For routine maintenance, you can wrap the key SMART operations into a shell script that checks each drive, logs results, and flags any failures. This script can be scheduled with cron or integrated into your monitoring pipeline.
The following script skeleton runs a SMART health check on all SATA/IDE drives and appends the output to a timestamped log file, then greps for "FAILED" or "FAILURE" to detect unhealthy units.
#!/bin/bash
# automate_smart_check.sh
LOG_DIR="/var/log/smart"
mkdir -p "$LOG_DIR"
for dev in /dev/sd? /dev/hd?; do
if [ -b "$dev" ]; then
timestamp=$(date +%Y-%m-%d_%H:%M)
log_file="$LOG_DIR/${dev##/dev/}_$timestamp.txt"
echo "Checking SMART status for $dev at $timestamp"
sudo smartctl -H "$dev" | tee -a "$log_file"
sudo smartctl -a "$dev" | tee -a "$log_file"
if sudo smartctl -H "$dev" | grep -E "FAILED|FAILURE"; then
echo "WARN: $dev reports SMART failure, check $log_file"
fi
fi
done
According to a 2025 benchmark across mid-size hosting providers, organizations that automated weekly SMART checks via cron jobs reduced unplanned storage outages by roughly 33% compared with those relying only on manual inspection.
Expert answers to Check Smart Status In Linux Dont Skip This Step queries
How do I install SMART tools on Linux?
To install SMART tools, use your distribution's package manager to install the smartmontools package; on Debian/Ubuntu run sudo apt install smartmontools, on RHEL-family systems use sudo yum install smartmontools or sudo dnf install smartmontools, and on openSUSE run sudo zypper install smartmontools. After installation, enable the smartd daemon with sudo systemctl enable --now smartd so it can periodically probe each drive and send alerts.
What does a "PASSED" or "FAILED" SMART status mean?
A SMART status of "PASSED" means the drive's internal health checks and vendor thresholds have not detected any critical faults at the time of the query. A status of "FAILED" or "FAILURE PREDICTED" indicates that one or more attributes have exceeded safe limits, often signaling that the drive is likely to fail soon and should be migrated or replaced.
Can I check SMART on an SSD the same way as a hard drive?
Yes, you can check SMART on an SSD using the same smartctl commands as on a traditional hard drive, but many SSDs expose additional NAND-specific attributes such as "Wear_Leveling_Count" and "Total_LBAs_Written." The command syntax is identical: for example, sudo smartctl -H /dev/nvme0n1 or sudo smartctl -H /dev/sda will return the health status for NVMe or SATA SSDs, respectively.
Do I need root to check SMART status?
In almost all cases, you do need root privileges or equivalent sudo access to read SMART data because the commands require direct hardware-level I/O permission. Running smartctl without elevated rights typically results in permission errors or truncated output that does not reflect the true drive health.
How often should I check SMART status on Linux?
For production Linux servers, it is recommended to run full SMART attribute checks weekly and to rely on the background smartd daemon for continuous polling, which can be configured to scan every 30 minutes to 2 hours. For desktop systems or less critical workloads, monthly checks via a cron script plus on-demand checks when the system feels sluggish or exhibits I/O errors are usually sufficient.