Self-Monitoring, Analysis and Reporting Technology (SMART) system is incorporated into many ATA-3 and later, IDE and SCSI-3 disks.
SMART monitors disks and can be used to predict drive failures, and to perform disk self-tests.

Install

The Alpine/Debian package is smartmontools, for Fedora it is included in kernel-utils.

root ~$ apk add smartmontools
fetch http://alpinelinux.mirrors.ovh.net/v3.21/main/x86_64/APKINDEX.tar.gz
fetch http://alpinelinux.mirrors.ovh.net/v3.21/community/x86_64/APKINDEX.tar.gz
fetch http://dl-2.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
WARNING: Permanently redirected to https://dl-2.alpinelinux.org:443/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/2) Installing smartmontools (7.4-r1)
(2/2) Installing smartmontools-openrc (7.4-r1)
Executing busybox-1.37.0-r12.trigger
OK: 2214 MiB in 992 packages

Verify disk supports SMART

The last 2 lines of the output tell you whether or not the disk supports SMART, in this example it does.

root ~$ smartctl -i /dev/sdb
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.12.18-0-lts] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF INFORMATION SECTION ===
Model Family:     Seagate FireCuda 2.5
Device Model:     ST1000LX015-1U7172
Serial Number:    WDEXAERC
LU WWN Device Id: 5 000c50 0acf05cdc
Firmware Version: SDM1
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Apr  2 08:38:32 2025 BST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Check disk for errors

root ~$ smartctl -l error /dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.12.18-0-lts] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
No Errors Logged

Example of bad disk

root ~$ smartctl -l error /dev/sdb
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.12.18-0-lts] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
ATA Error Count: 62 (device log contains only the most recent five errors)
        CR = Command Register [HEX]
        FR = Features Register [HEX]
        SC = Sector Count Register [HEX]
        SN = Sector Number Register [HEX]
        CL = Cylinder Low Register [HEX]
        CH = Cylinder High Register [HEX]
        DH = Device/Head Register [HEX]
        DC = Device Command Register [HEX]
        ER = Error register [HEX]
        ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.
 
Error 62 occurred at disk power-on lifetime: 60892 hours (2537 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.
 
  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 60 f1 1f 0d  Error: WP at LBA = 0x0d1ff160 = 220197216
 
  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  61 00 18 ff ff ff 4f 00   2d+16:54:40.960  WRITE FPDMA QUEUED
  61 00 10 ff ff ff 4f 00   2d+16:54:40.959  WRITE FPDMA QUEUED
  61 00 08 40 19 34 4c 00   2d+16:54:40.959  WRITE FPDMA QUEUED
  61 00 08 80 87 15 48 00   2d+16:54:40.959  WRITE FPDMA QUEUED
  61 00 30 a0 a1 36 46 00   2d+16:54:40.959  WRITE FPDMA QUEUED

Retrieve all SMART data from disk which should include metrics.
In this example, the Pre-Fail metrics all exceed the manufacturers threshold.

root ~$ smartctl -a /dev/sdb
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.12.18-0-lts] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF INFORMATION SECTION ===
Model Family:     Seagate FireCuda 2.5
Device Model:     ST1000LX015-1U7172
Serial Number:    WDEXAERC
LU WWN Device Id: 5 000c50 0acf05cdc
Firmware Version: SDM1
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Apr  2 09:19:17 2025 BST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
 
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
 
General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (    0) seconds.
Offline data collection
capabilities:                    (0x71) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 167) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x3035) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.
 
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   062   045   006    Pre-fail  Always       -       79509560
  3 Spin_Up_Time            0x0003   099   099   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       312
  5 Reallocated_Sector_Ct   0x0033   078   078   036    Pre-fail  Always       -       13096
  7 Seek_Error_Rate         0x000f   090   060   045    Pre-fail  Always       -       926066536
  9 Power_On_Hours          0x0032   031   031   000    Old_age   Always       -       60922 (175 48 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       64
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   038   038   000    Old_age   Always       -       62
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       77310656535
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   071   049   040    Old_age   Always       -       29 (Min/Max 29/42)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       30
193 Load_Cycle_Count        0x0032   096   096   000    Old_age   Always       -       8757
194 Temperature_Celsius     0x0022   029   051   000    Old_age   Always       -       29 (0 19 0 0 0)
197 Current_Pending_Sector  0x0012   098   097   000    Old_age   Always       -       216
198 Offline_Uncorrectable   0x0010   098   097   000    Old_age   Offline      -       216
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       60954h+08m+58.229s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       312698923751
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       411335859664
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0
 
SMART Error Log Version: 1
ATA Error Count: 62 (device log contains only the most recent five errors)
...