Control and monitor SMART disks on Linux

Intro

According to wikipedia, S.M.A.R.T. stand for Self-Monitoring, Analysis and Reporting Technology, which 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 will see how to read the SMART attributes thanks to smartctl tool on GNU/Linux systems.

Configuration

  • OS : Debian 11 bullseye
  • smartmontools : 7.2

Installing

root@host:~# apt-get 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>
  • Prints all SMART attributes about the disk :
root@host:~# smartctl -a /dev/<device>
  • Check criticals attributes :
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"

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 :