Monitoring the physical health of spinning hard disk drives (HDDs) and solid-state drives (SSDs) is a critical responsibility for Linux system administrators. While tools like smartctl (from smartmontools) are widely used, modern Linux storage daemons—including udisks2 and GNOME Disks—rely internally on libatasmart to parse Self-Monitoring, Analysis, and Reporting Technology (S.M.A.R.T.) telemetry. The skdump command-line utility provides direct access to this library, delivering concise, standardized, and easily parsed drive health metrics, bad sector counts, and thermal thresholds straight from the Linux terminal.
Understanding libatasmart and S.M.A.R.T. Telemetry
Hard drives and SSDs continuously monitor their internal electromechanical and flash block conditions through firmware-level S.M.A.R.T. attributes. These attributes track reallocated sectors, spin retry counts, power-on hours, read error rates, and temperature fluctuations.
The libatasmart library was developed by the FreeDesktop project to provide a lean, fast, and spec-compliant library for querying ATA devices over the kernel SCSI/ATA translation (SAT) layer. Unlike raw binary dumps, skdump decodes standardized attribute IDs, applies normalized manufacturer thresholds, and categorizes drive condition into an overall operational health verdict (Good, Bad, or Warning) that matches what desktop desktop managers and system monitoring agents report.
Installing skdump on Linux Distributions
On modern Debian, Ubuntu, and Fedora distributions, skdump is packaged within the libatasmart-bin or libatasmart package.
To install it on Ubuntu or Debian, execute:
sudo apt update
sudo apt install libatasmart-bin
On Fedora, Rocky Linux, or RHEL-based systems:
sudo dnf install libatasmart
Once installed, the skdump binary is available in /usr/sbin/skdump or /usr/bin/skdump.
Running a Basic Drive Health Audit with skdump
Because querying low-level ATA registers requires communicating directly with raw block devices, skdump requires root privileges.
To inspect a disk drive (for example, /dev/sda or /dev/sdb), execute:
sudo skdump /dev/sda
The terminal outputs a structured diagnostic report structured into distinct sections:
Device: /dev/sda
Model: Samsung SSD 870 EVO 1TB
Serial: S5Y2NJ0R123456
Firmware: SVT02B6Q
SMART Available: yes
Overall Status: GOOD
ID# Name Current Worst Threshold Value Status Flags
5 Reallocated Sector Count 100 100 010 0 good pre-fail
9 Power-On Hours 099 099 000 4250 good online
12 Power Cycle Count 098 098 000 120 good online
190 Airflow Temperature 068 052 045 32 C good online
194 Temperature Celsius 068 052 000 32 C good online
199 UDMA CRC Error Count 100 100 000 0 good online
This report highlights vital drive indicators:
- Overall Status: The definitive verdict from
libatasmart. If this indicatesBADorWARNING, the drive is failing manufacturer reliability thresholds and should be backed up and replaced immediately. - Reallocated Sector Count: Number of damaged physical sectors that the drive controller retired and remapped to spare reserve tracks. A non-zero value that increases over time indicates physical platter decay.
- UDMA CRC Error Count: Indicates data transmission errors between the drive controller and motherboard SATA interface, frequently pointing to damaged SATA cables.
Querying Specific Diagnostic Values via Shell Flags
For administrative shell scripts, automated backup pre-checks, or remote monitoring agents, parsing the entire multiline report is unnecessary. skdump provides targeted command flags that output single parameters directly to standard output.
To check only whether the drive passes the general SMART health check:
sudo skdump --overall /dev/sda
The command returns GOOD or BAD, allowing you to write simple conditional guards in automation scripts:
if [ "$(sudo skdump --overall /dev/sda)" != "GOOD" ]; then
echo "Alert: Disk /dev/sda is degrading! Halting backup." | mail -s "Disk Alert" [email protected]
fi
To retrieve the drive’s current operating temperature in Celsius:
sudo skdump --attribute=194 /dev/sda
Running and Evaluating S.M.A.R.T. Self-Tests
Drive firmware contains embedded self-test routines that can be initiated via libatasmart. These tests evaluate motor mechanics, read/write heads, and flash block integrity.
To initiate a short background self-test, use:
sudo skdump --test=short /dev/sda
For an exhaustive sector-by-sector surface inspection, initiate a long test:
sudo skdump --test=long /dev/sda
Self-tests execute in the drive firmware in the background while the system remains usable. You can check the self-test execution progress and historical log status at any time by running sudo skdump /dev/sda and inspecting the bottom Test Status lines.
Auditing Disks in NVMe vs SATA Environments
Note that skdump is designed specifically for ATA, SATA, and SCSI drives communicating through the SAT kernel translation layer. For modern NVMe storage (e.g., /dev/nvme0n1), S.M.A.R.T. health logs follow the distinct NVMe specification and are audited using nvme-cli (sudo nvme smart-log /dev/nvme0).
Incorporating skdump into your Linux administration toolkit provides an instant, lightweight, and spec-compliant method for auditing drive health and preventing data loss from unexpected hardware failures.