skip to content
Burak Berk Keskin
Table of Contents

Overview

Smartmontools provides smartctl and smartd to monitor and manage the health of storage devices using S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology). It supports ATA/SATA, NVMe, and USB-connected drives through different device type drivers.

Installing Smartmontools

Debian and Ubuntu

Install smartmontools via APT:

Terminal window
sudo apt update && sudo apt install smartmontools

General Smartctl Commands

1. List the Disks

List attached block devices before querying smartctl:

Terminal window
lsblk

2. Check SMART Support

Terminal window
smartctl -i /dev/sdX

Replace /dev/sdX with the target drive device node (for example, /dev/sda).

3. Enable SMART on a Drive

Terminal window
smartctl -s on /dev/sdX

4. Inspect Full SMART Attributes

Terminal window
smartctl -a /dev/sdX

5. Run SMART Self-Tests on HDDs

Short Test (Quick Health Check)

Terminal window
smartctl -t short /dev/sdX

Long Test (Comprehensive Surface Scan)

Terminal window
smartctl -t long /dev/sdX

View Self-Test Logs

Terminal window
smartctl -l selftest /dev/sdX

6. Run SMART Self-Tests on NVMe SSDs

Start a short self-test:

Terminal window
sudo smartctl -t short /dev/nvme1n1

Start an extended self-test:

Terminal window
sudo smartctl -t long /dev/nvme1n1

Inspect the latest self-test output and health attributes:

Terminal window
sudo smartctl -a /dev/nvme1n1

Abort an active self-test:

Terminal window
sudo smartctl -X /dev/nvme1n1

7. View SMART Error Logs

Terminal window
smartctl -l error /dev/sdX

Handling Unknown USB Enclosures

When I connected an external NVMe SSD inside a USB enclosure to my server, smartctl failed to read any health telemetry on its own. Running a basic device info query produced:

Terminal window
smartctl -i /dev/sdb
/dev/sdb: Unknown USB bridge [0x0bda:0x0bda (0x2001)]

I checked the USB enclosure bridge vendor and device ID with lsusb:

Terminal window
lsusb -v -d 0x0bda:0x0bda
...
Bus 003 Device 002: ID 0bda:0bda Realtek Semiconductor Corp. RTL9210B
...

Cross-referencing the smartmontools USB device table confirmed that the Realtek RTL9210B bridge requires the -d sntrealtek driver flag:

Terminal window
smartctl -i -d sntrealtek /dev/sdX

With -d sntrealtek passed explicitly, both health attributes and temperature readings report cleanly across external USB enclosures. For automating this inside a hypervisor daemon so smartd stops flagging false UNKNOWN status emails, see my follow-up notes on fixing unknown SMART status on Proxmox VE.