rss logo

Control and monitor SMART disks on Linux

Intro

According to wikipedia, S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) is a monitoring system included in computer hard disk drives (HDDs) and solid-state drives (SSDs) that detects and reports on various indicators of drive reliability, with the intent of enabling the anticipation of hardware failures.

We'll see how to read SMART attributes using the smartctl tool on GNU/Linux systems.

Configuration

  • OS: Debian 12 Bookworm
  • smartmontools: 7.3

Installing

root@host:~# apt update && apt install smartmontools

Commands

Basic commands

  • Check if SMART is enabled:
root@host:~# smartctl -i /dev/<device>
  • Enable SMART:
root@host:~# smartctl -s on /dev/<device>
  • Print all SMART disk attributes:
root@host:~# smartctl -a /dev/<device>
  • Check criticals attributes, we can see in this example that the disk is dying:
root@host:~# smartctl -a /dev/<device> | grep -Ei "Reallocated|Spin.*Retry|SATA*Downshift|End-to-End|Reported.*Uncorrectable|Timeout|Reallocation|Current.*Pending|Uncorrect|TA.*Counter|Drive.*Life.*Protection" 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 408 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0 187 Reported_Uncorrect 0x0032 075 075 000 Old_age Always - 25 188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0

Check with RAID controller

Dell PERC Controller

  • Check disk number 8:
root@host:~# smartctl -a -d megaraid,8 /dev/sda

HP Smart Array Controller

  • Check disk number 1:
root@host:~# smartctl -a -d cciss,0 /dev/sda

Run Tests

Here we will see how to perform SMART self tests on disk.

Short test

  • Run tests that have a high probability of detecting device problems:
root@host:~# smartctl -t short /dev/<device>

Long test

  • Long check with complete disk surface examination:
root@host:~# smartctl -t long /dev/<device>

Conveyance test

  • Identifies if damage incurred during transportation of the device:
root@host:~# smartctl -t conveyance /dev/<device>

Check current test status

root@host:~# smartctl -l selftest /dev/<device>

Print results

root@host:~# smartctl -H /dev/<device>

Check if errors

root@host:~# smartctl -l selftest /dev/<device> root@host:~# smartctl -l error /dev/<device>
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address