Linux

How to Check SSD Health in Linux

Check SATA and NVMe SSD health on a Linux server with smartctl, nvme-cli and mdadm: wear, temperature, media errors, kernel messages and RAID status.

SSDs rarely fail without warning. Wear, heat, media errors and RAID problems usually show up in the drive's own health data or in the kernel log first. This guide shows how to read those signs on a Linux server, for both SATA and NVMe drives. Every command here only reads information, except the self-test in step 7, which is safe but adds some load.

Quick answer

Install smartmontools, then run smartctl -a /dev/sda for a SATA SSD or smartctl -a /dev/nvme0 for an NVMe SSD. A healthy drive shows PASSED, a critical warning of 0x00, zero media errors, and spare space well above its threshold. If the server uses software RAID, also run cat /proc/mdstat and check that every member shows U.

What you need: root access (log in as root or put sudo in front of each command) and a few minutes. Keep a current backup before any disk, filesystem or RAID maintenance. RAID protects against a failed drive; it is not a backup.

1. Find your drives

lsblk -o NAME,MODEL,SERIAL,SIZE,TYPE,MOUNTPOINT
NAME        MODEL                SERIAL      SIZE TYPE MOUNTPOINT
sda         Samsung SSD 870 EVO  S6ABC123    1.8T disk
└─sda1                                       1.8T part
nvme0n1     Samsung SSD 970 EVO  S5XYZ789    1.8T disk
└─nvme0n1p1                                  1.8T part /

SATA drives appear as sda, sdb and so on. NVMe drives appear as nvme0n1, where nvme0 is the controller and n1 the namespace. Note the serial numbers: when a drive has to be replaced, the serial is how you pull the right one from the server.

2. Install the tools

smartctl comes from smartmontools, and the nvme command from nvme-cli.

On AlmaLinux, Rocky Linux and other RHEL-based systems:

dnf install smartmontools nvme-cli

On Debian or Ubuntu:

apt install smartmontools nvme-cli

3. Check the overall SMART result

For a SATA SSD:

smartctl -a /dev/sda

For an NVMe SSD, point it at the controller:

smartctl -a /dev/nvme0

Near the top of the output you will find:

SMART overall-health self-assessment test result: PASSED

PASSED is a good start, but it only means the drive has not crossed its manufacturer's failure threshold. A drive can say PASSED and still show warning signs in the values below, so keep reading. smartctl manual

4. Check wear, spare space and temperature

On NVMe drives, the same smartctl -a /dev/nvme0 output includes:

Critical Warning:                   0x00
Temperature:                        45 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    18%
Media and Data Integrity Errors:    0
  • Critical Warning should be 0x00. Anything else means the drive itself is flagging a problem.
  • Percentage Used is the controller's estimate of how much of its rated endurance is used up. It can pass 100% and the drive may keep working, but plan a replacement well before then.
  • Available Spare is the reserve of spare blocks. Worry when it falls towards the threshold.
  • Temperature: what is acceptable depends on the model, so check its datasheet. Sustained high temperatures cause throttling and slow the server down.

SATA SSDs report wear through vendor-specific attributes, with names such as Wear_Leveling_Count, Percent_Lifetime_Remain or Media_Wearout_Indicator. Check what your model's attributes mean before comparing numbers between brands. Also watch Reallocated_Sector_Ct and Reported_Uncorrect: they should stay at or near zero and not grow.

5. Read the NVMe health and error logs

nvme-cli shows the same health data in its own format, which is handy for scripts and monitoring: nvme-cli

nvme list
nvme smart-log /dev/nvme0

The values to watch are critical_warning, percentage_used, available_spare, media_errors and unsafe_shutdowns.

media_errors is the most important number. It should be 0. A count that keeps rising is a strong sign the flash is failing.

The error log is different, and often misread:

nvme error-log /dev/nvme0

A line such as Error Information Log Entries: 92 does not mean 92 bad blocks. Many entries are harmless, for example Invalid Field in Command, which only means software sent a command the drive does not support. Look at the error types, not just the count.

6. Check the kernel log

The kernel often records storage trouble that SMART does not show yet.

journalctl -k | grep -iE 'i/o error|reset|timeout|nvme|ata[0-9]'

On systems without systemd, use dmesg instead of journalctl -k.

Look for I/O errors, controller resets, timeouts, link failures and drives disconnecting. A single old message may mean nothing. Repeated I/O errors or resets mean you should check that drive now.

7. Run a SMART self-test

A self-test makes the drive scan itself. Check whether the drive supports it:

smartctl -c /dev/sda

Start a short test, which usually takes a couple of minutes:

smartctl -t short /dev/sda

When it finishes, read the result:

smartctl -l selftest /dev/sda

A long test (-t long) checks the whole drive and can take hours. It runs while the server keeps working, but adds disk load, so start it at a quiet time on a busy production server. Most recent NVMe drives support self-tests too: use the same commands with /dev/nvme0.

8. Check software RAID

If the server uses Linux software RAID (mdadm), check the array as well as the drives.

cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
      1953381376 blocks super 1.2 [2/2] [UU]

[UU] means both members of this two-drive RAID1 are working. [U_] means one member is missing or failed. A three-drive RAID5 that is healthy shows [UUU]. Linux md documentation

For more detail:

mdadm --detail /dev/md0
        Raid Level : raid1
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0

You want State : clean (or active) and Failed Devices : 0. The device list at the bottom shows which partitions belong to the array; match them to serial numbers with the lsblk command from step 1. mdadm manual

After a failed drive is replaced, /proc/mdstat shows the array rebuilding:

[=>...................]  recovery = 5.2% (101580800/1953381376) finish=150.3min

The server is slower while this runs. Do not remove any other drive until it reaches 100%.

9. When to replace an SSD

Replace the drive, or at least investigate it closely, if you see any of these:

  • media_errors, Reallocated_Sector_Ct or Reported_Uncorrect going up
  • a critical warning other than 0x00
  • available spare close to its threshold, or wear close to its rated limit
  • repeated I/O errors or controller resets in the kernel log
  • a failed self-test
  • the drive dropping out of the system or out of the RAID array

No single number tells the whole story. Check SMART, the kernel log and RAID status together, and record the values every month or so. A slow rise over time warns you well before a failure.

Quick health check

For a server with an NVMe drive in software RAID, these commands give a good overall picture:

lsblk -o NAME,MODEL,SERIAL,SIZE,TYPE,MOUNTPOINT
smartctl -a /dev/nvme0
nvme smart-log /dev/nvme0
journalctl -k | grep -iE 'i/o error|reset|timeout|nvme'
cat /proc/mdstat
mdadm --detail /dev/md0

A full filesystem can look like a failing disk. To rule that out, see How to Check Disk Space in Linux.

Sources

  1. smartctl manual page (smartmontools)
  2. nvme-cli project
  3. Linux kernel documentation: RAID arrays (md)
  4. mdadm manual page

Written by Tharanga. Commands and procedures depend on your system and software version.

How we approach technical guides →
FOLLOW THE THREAD

Keep exploring

All guides
Linux1 min read

How to Check Disk Space in Linux

See how much disk space is free on a Linux server and find the folders using the most space, with two beginner-friendly commands: df and du.