SMART Disk Health & Test

Disk Manager · Utilities~10 minView script

Read SMART data and trigger self-tests on the physical disks attached to the Proxmox host. ProxMenux auto-installs smartmontools for SATA / SAS and nvme-cli for NVMe, runs the action inside the drive firmware (long tests survive terminal close) and exports JSON results for the ProxMenux Monitor.

What this is for

SMART (Self-Monitoring, Analysis and Reporting Technology) lets the drive itself report its health and run self-tests. This tool exposes that data without you needing to remember the right smartctl / nvme invocation, and persists the output as JSON so the Monitor can graph trends over time.

How the script runs

All actions here are non-destructive — SMART reads the drive firmware counters, and self-tests are queued inside the drive itself. No phase separation is needed. The flow is: dependency check → disk selection → action selection → tool invocation (smartctl or nvme-cli depending on the disk bus) → printed output plus JSON export for the Monitor.

        Detect dependencies (first run)
        ├─ smartctl  present? (smartmontools)
        └─ nvme      present? (nvme-cli)
        Any missing → apt-get install silently
                           │
                           ▼
        Enumerate disks on host (lsblk)
        (no safety filter — read-only tool,
         root / system disks are shown too)
                           │
                           ▼
        User picks a disk
                           │
                           ▼
        Detect disk class from path / TRAN
        ├─ /dev/nvme*      → NVMe
        └─ anything else   → SATA / SAS / SCSI
                           │
                           ▼
        Action menu (loop — stays open after
        each action so you can chain queries)
                           │
  ┌────────────────┬────────────────┬────────────────┬───────────────┐
  ▼                ▼                ▼                ▼               ▼
 Quick         Full             Short            Long             Check
 status        report           test             test             progress
 (instant)     (instant)        (~2 min)         (hours)          (instant)
  │             │                │                │                │
  │             │                │                │                │
  │             │                │ Long test only:                  │
  │             │                │ confirm "runs in background,     │
  │             │                │ result saved to JSON"            │
  │             │                │                │                │
  │             │                └───────┬────────┘                │
  │             │                        │                         │
  │             │               Queued on drive firmware:           │
  │             │               ├─ SATA/SAS: smartctl -t short|long │
  │             │               └─ NVMe:     nvme device-self-test  │
  │             │               Returns to menu while running       │
  │             │                                                  │
  ▼             ▼                                                  ▼
 Read:         Read:                                         Read status:
 SATA/SAS →    SATA/SAS →                                   SATA/SAS →
  smartctl -H   smartctl -x                                  smartctl -c
  smartctl -A                                                NVMe →
                                                             nvme self-test-log
 NVMe →        NVMe →
  nvme smart-   nvme smart-log
  log           + nvme id-ctrl
  │             │                                                  │
  └──────┬──────┴──────────────────────────────────────────────────┘
         │
         ▼
   Output to terminal (color-coded when applicable)
         +
   JSON export to:
   /usr/local/share/proxmenux/smart/<disk>/
       <YYYY-MM-DD_HHMMSS>_<action>.json
         │
         ▼
   Retention policy: oldest beyond the limit
   are trimmed automatically
         │
         ▼
   ProxMenux Monitor reads these files to
   render health trends per disk over time

Dependencies

The tool auto-installs what it needs on first run. SATA / SAS drives rely on smartmontools; NVMe drives rely on nvme-cli. Both:

apt-get install smartmontools nvme-cli

Available actions

ActionWhat it reads / runsDuration
Quick health statusOverall PASSED/FAILED + key attributes.<br/>smartctl -H + -A (SATA/SAS) or nvme smart-log (NVMe).Instant
Full reportComplete SMART data, scrollable. smartctl -x for SATA/SAS or nvme smart-log + id-ctrl for NVMe.Instant
Short testBasic surface and electrical check, queued inside the drive firmware.~2 minutes
Long testFull scan of the entire surface. Runs on the drive hardware — persists even if you close the terminal.Hours (disk size dependent)
Check test progressStatus of the active or most recent self-test.Instant

Long tests survive terminal close

A long test is queued inside the drive — it does not depend on the ProxMenux process staying alive. You can close the terminal, reboot the Proxmox host (the test picks up where it left off on some drives) or just come back later and use Check test progress to see the result.

JSON export for the Monitor

Every run writes a timestamped JSON file to /usr/local/share/proxmenux/smart/&lt;disk&gt;/. The structure is:

/usr/local/share/proxmenux/smart/
├── sda/
│   ├── 2026-04-23_145312_status.json
│   ├── 2026-04-23_180041_short.json
│   └── 2026-04-24_020015_long.json
└── nvme0n1/
    ├── 2026-04-23_145318_status.json
    └── 2026-04-24_021407_long.json

The ProxMenux Monitor picks these up to render health trends per disk; old files are rotated out automatically once the retention limit is reached.

Step-by-step

Step 1

Pick a disk

ProxMenux lists every physical disk on the host with its model and size. Unlike the Format tool, this list is not filtered by safety — reading SMART is a non-destructive operation.

SMART disk selection menu
SMART disk selection menu
Step 2

Pick an action

Choose between Quick health status, Full report, Short test, Long test or Check progress. The menu stays open after each action so you can chain several queries against the same disk.

SMART action menu
SMART action menu (5 actions + cancel)
Step 3

(Long test only) Confirm background execution

ProxMenux warns that the test will keep running after the terminal closes and shows where the JSON result will land. Accept to queue it.

Long test confirmation dialog
Long test confirmation — runs in background, result saved to JSON
Step 4

Review results

Status and report are printed to the terminal and written to JSON. For long tests, return later and run Check test progress on the same disk to see the outcome.

Quick health status output
Quick health status output (SATA — smartctl -H + -A)

Manual equivalents

# --- SATA / SAS drives (smartmontools) ---
# quick health
smartctl -H /dev/sdX
smartctl -A /dev/sdX           # attribute table

# full report
smartctl -x /dev/sdX

# self-tests
smartctl -t short    /dev/sdX
smartctl -t long     /dev/sdX
smartctl -c /dev/sdX | head    # current test progress

# --- NVMe drives (nvme-cli) ---
nvme smart-log   /dev/nvme0n1
nvme id-ctrl     /dev/nvme0n1
nvme self-test-log /dev/nvme0n1

NVMe self-tests are drive-firmware dependent

Not every NVMe drive supports the short/long self-test command. If a drive refuses the test, the SMART log and the ID controller data (nvme smart-log + id-ctrl) are still the most reliable health signal.

Troubleshooting

"Could not read SMART data from /dev/sdX"

The disk is probably behind a RAID / SAS controller that does not pass SMART through. With megaraid-based cards, try smartctl -d megaraid,N /dev/sdX. For HBAs in IT mode the direct invocation works.

Long test never completes

The test is queued on the drive firmware and pauses if the disk is under heavy load. Running it overnight on an idle system usually works. You can also check smartctl -c to see percentage remaining; if it is stuck at a fixed LBA, the disk is failing at that sector.

Related