SMART (Self-Monitoring, Analysis and Reporting Technology) is a monitoring system included in all computer hard drives and solid state drives.

Usage[edit | edit source]

On Linux, install the smartmon-tools package. Use the smartctl utility.

Show Disk Information[edit | edit source]

To show all capabilities, monitored attributes, errors, etc. of a particular disk, run:

# smartctl -a /dev/sda

Run Self-Test[edit | edit source]

Use the short option to begin a self-test on the device. To abort a test, use the -X or --abort option.

Troubleshooting[edit | edit source]

USB Support[edit | edit source]

When working with hard drives connected via USB, you need to disable USB Attached SCSI (UAS). Otherwise, smartctl will report:

# smartctl -a /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.6.14-300.fc32.x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: scsi error unsupported field in scsi command

To disable UAS for a specific USB device, find the USB device associated with the drive. Check dmesg or run lsusb. Unload the usb-storage kernel module and re-load it with a quirk parameter specifying which device to not enable UAS on.

# lsusb
Bus 002 Device 005: ID 0bc2:3343 Seagate RSS LLC

# rmmod usb-storage
# modprobe usb-storage quirks=0bc2:3343:u

Re-attach the USB device again. This time, dmesg should say that a quirk was detected for this device:

[947347.271519] usb 2-3.2: New USB device found, idVendor=0bc2, idProduct=3343, bcdDevice= 1.00
[947955.635329] usb-storage 2-3.2:1.0: Quirks match for vid 0bc2 pid 3343: 800000

Re-run smartctl. It should be able to see the SMART parameters. For some devices, you may need to also pass in a -d option. Check the supported devices page. https://www.smartmontools.org/wiki/Supported_USB-Devices for more information.

To make this kernel module option persistent, create a file in /etc/modprobe.d with options usb-storage quirks=VendorId:ProductId:u.

See also: https://askubuntu.com/questions/637450/cannot-perform-smart-data-and-self-test-on-external-hard-drive

Attributes[edit | edit source]

Some attributes of note.

Reallocated_Sector_Ct
Disks automatically remap bad sectors to a pool of reserved sectors. This attribute is the number of sectors that have been reallocated.
Current_Pending_Sector
The number of sectors that the disk had issues reading. The sector will be reallocated when either: 1. the sector can be read properly or 2. the sector is written over.

See Also[edit | edit source]