Linux

How to Diagnose and Check Disk Health in Linux

In this guide, you'll learn how to check the health of HDDs and SSDs in Linux using built-in tools to proactively identify issues and prevent data loss.

Updated at February 15, 2026
5-15 min
Medium
FixPedia Team
Применимо к:Ubuntu 20.04+Debian 10+CentOS 7+Fedora 35+

Introduction

Disk health checking is a critically important procedure for any Linux user, whether it's a home PC or a server. Over time, drives (HDD or SSD) can develop hidden errors that lead to sudden failure and data loss. Using SMART technology and the smartctl utility, you can diagnose disk state in advance, preventing catastrophic failures. This guide will walk you through simple steps to check disk health in Linux.

Requirements

Before starting, ensure that:

  • You have access to a Linux terminal with sudo privileges.
  • The smartmontools package is installed. If not, the first step will show how to install it.
  • You know your disk identifier (e.g., /dev/sda). Be careful: operations on the wrong disk can lead to data loss.

Step 1: Installing smartmontools

The smartctl utility is included in the smartmontools package. If it is not installed, install it via your distribution's package manager.

For Ubuntu/Debian:

sudo apt update
sudo apt install smartmontools

For CentOS/RHEL:

sudo yum install smartmontools

For Fedora:

sudo dnf install smartmontools

For Arch Linux:

sudo pacman -S smartmontools

After installation, check the version: smartctl --version.

Step 2: Identifying the Disk

Before checking, you need to know which disk to check. Use the lsblk command to list block devices:

lsblk

The output will show all disks and partitions. Usually, the main disk is /dev/sda or /dev/nvme0n1 for NVMe. For more detailed information, use sudo fdisk -l.

💡 Tip: If you have multiple disks, check each one that contains important data.

Note the disk identifier (e.g., /dev/sda). Use this identifier in all subsequent commands.

Step 3: Checking Overall Health

Now perform a quick overall health check:

sudo smartctl -H /dev/sda

Replace /dev/sda with your disk.

Example output:

smartctl 7.2 2021-04-09 r5141 [x86_64-linux-5.4.0-80-generic] (local build)
Copyright (C) 2002-21, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

⚠️ Important: If the result is FAILED, the disk already has issues and may fail at any moment. Immediately create a backup and plan for replacement.

If PASSED, it's a good sign but not a guarantee. Continue with a detailed check.

Step 4: Viewing Detailed SMART Attributes

For a deeper analysis, view all SMART attributes:

sudo smartctl -A /dev/sda

The output will be lengthy. Pay attention to the following key attributes (values may differ for HDD and SSD):

  • Reallocated_Sector_Ct: Number of sectors reallocated to spares. A non-zero value indicates disk wear.
  • Current_Pending_Sector: Sectors awaiting reallocation. A high value is a sign of problems.
  • Uncorrectable_Sector_Ct: Sectors with uncorrectable errors. Should be 0.
  • SMART 5: Reallocated_Sector_Ct and SMART 187: Reported_Uncorrect for SSDs.

Example:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
197 Current_Pending_Sector 0x0032   100   100   000    Old_age   Always       -       0
198 Uncorrectable_Sector_Ct 0x0030   100   100   000    Old_age   Offline      -       0

If the RAW_VALUE for these attributes is greater than 0, the disk requires attention.

Step 5: Running Drive Tests

SMART allows you to run self-tests on the disk. There are two main types: short and long. The short test checks essential components and takes a few minutes. The long test is a full check of all sectors and can take hours.

Run the short test:

sudo smartctl -t short /dev/sda

For the long test:

sudo smartctl -t long /dev/sda

After starting, the test runs in the background. You can check progress and results with the command:

sudo smartctl -l selftest /dev/sda

The output will show the test history. Look for the line with Completed and No error or Finished without error.

💡 Tip: Run tests during periods of low disk load, especially the long one, to avoid impacting performance.

Step 6: Analyzing Results and Actions

Gather all information:

  1. Overall health status: should be PASSED.
  2. Critical SMART attributes: should be 0 or low.
  3. Self-test results: should be error-free.

If any of these points show issues:

  • Immediately create a full backup of all data from the disk.
  • Plan to replace the disk soon.
  • For servers, consider migrating to a new drive.

If all indicators are normal, the disk is healthy. It is recommended to repeat the check every 1-3 months.

Verifying the Result

After completing all steps, you should have a clear understanding of the disk's condition. Ensure that:

  • The command sudo smartctl -H /dev/sda showed PASSED.
  • There are no increasing values in critical attributes.
  • Self-test completed without errors.

If all conditions are met, the disk is considered operational. Otherwise, act according to the recommendations in Step 6.

Possible Issues

During the check, the following problems may arise:

  • Access error: If you see smartctl: Permission denied or Unable to get SMART data, ensure you are using sudo or running as root.
  • Disk does not support SMART: Some older or external disks may not support SMART. In this case, smartctl will report it. For such disks, use other diagnostic methods, e.g., badblocks or system log monitoring.
  • Test does not start: If smartctl -t returns an error, the disk may be busy or have hardware issues. Try rebooting the system or checking cables.
  • False positives: Some attributes may have non-zero values due to manufacturing characteristics. Compare with thresholds (THRESH) and trend (WORST). Sudden changes are cause for concern.

💡 Tip: Regularly monitor changes in SMART attributes. You can set up automatic reports via cron, using smartctl -A and analyzing the output.

F.A.Q.

What is SMART and why is it needed?
How often should you check disk health?
What to do if a SMART test shows errors?
Can you check disk health without root privileges?

Hints

Install smartmontools
Identify the disk
Check overall health status
View detailed SMART attributes
Run drive tests
Analyze results and take action
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community