How to Check the SMART Health Status of a Hard Drive in Linux Using smartctl

Hard drives and solid-state drives (SSDs) do not live forever. Whether running a critical database server or a home NAS, a sudden drive failure can result in catastrophic data loss. Fortunately, almost all modern storage drives feature S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology). This internal firmware constantly monitors the physical health of the drive, tracking things like spin-up times, read errors, and bad sectors.

If a drive is preparing to die, S.M.A.R.T. will usually throw internal warning flags days or even weeks before the actual hardware failure occurs. In Linux, you can manually query this internal firmware using the powerful command-line utility called smartctl.

Step 1: Install smartmontools

The smartctl command is part of the smartmontools package, which is generally not installed by default on minimal Linux distributions.

  • On Debian/Ubuntu:
    sudo apt update && sudo apt install smartmontools -y
  • On RHEL/CentOS/Fedora:
    sudo dnf install smartmontools -y

Step 2: Identify Your Hard Drive

Before you can scan a drive, you need to know its device identifier (e.g., /dev/sda or /dev/nvme0n1).

  1. Run the following command to list all attached storage devices:
    lsblk
  2. Locate the drive you want to test in the list and note its name (ignore the partition numbers like sda1; you need the root drive name, sda).

Step 3: Run a Basic Health Assessment

The easiest way to check if a drive is failing is to ask the firmware for a basic “Pass/Fail” assessment.

  1. Run the following command (replace /dev/sda with your actual drive):
    sudo smartctl -H /dev/sda

Look at the output. If it says SMART overall-health self-assessment test result: PASSED, the drive’s firmware currently believes it is healthy. If it says FAILED, the drive is actively dying, and you must back up your data immediately.

Step 4: View the Detailed S.M.A.R.T. Attributes

A “PASSED” result doesn’t mean the drive is flawless; it just means it hasn’t crossed the manufacturer’s failure threshold yet. To see the raw data and spot early warning signs, you need to view the full attributes list.

sudo smartctl -A /dev/sda

This will print a massive table of data. Here are the most critical attributes you need to look at:

  • Reallocated_Sector_Ct (ID 5): This is the most important metric. When the drive detects a physically broken sector on the disk platter, it permanently blocks it off and moves the data to a spare sector. If the “RAW_VALUE” column for this attribute is anything higher than 0, the physical disk surface is degrading.
  • Current_Pending_Sector (ID 197): These are sectors that are failing to read properly but haven’t been permanently reallocated yet. Any number above 0 here is a massive red flag.
  • Power_On_Hours (ID 9): Exactly how many hours the drive has been spinning. Useful for determining the absolute age of the hardware.

Step 5: Run a Manual Self-Test

If you suspect the drive is acting strangely but the health assessment says “PASSED”, you can force the drive to run an internal diagnostic test.

sudo smartctl -t short /dev/sda

This will initiate a 2-minute test in the background. (You can use -t long for a thorough, multi-hour surface scan). Once the test finishes, you can view the results by running:

sudo smartctl -l selftest /dev/sda

This will output a log showing exactly when the test ran and if it encountered any read failures.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.