Skip to content

SoraStr/QDisk

Repository files navigation

QDisk

macOS disk health monitor — read SMART attributes from NVMe & ATA drives via native IOKit plugin interfaces.

QDisk provides a clean, native macOS interface for inspecting S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) data from your storage devices. It uses the same approach as smartmontools — Apple's official IOATASMARTInterface / IONVMeSMARTInterface COM plugin interfaces — to retrieve full NVMe SMART/Health Information Logs and ATA SMART attribute tables without hacky reverse-engineered IOConnect calls.

Features

  • Native IOKit SMART access — uses IOCreatePlugInInterfaceForService + COM vtable calls, matching smartmontools' approach
  • NVMe & ATA support — reads full NVMe SMART/Health logs (14 fields) and ATA attribute tables (30 attributes with thresholds)
  • No root required — NVMe SMART data is accessible without sudo on macOS
  • Four-language i18n — English, 简体中文, 繁體中文, 日本語, auto-detected from system locale

Screenshots

┌─ Disk List ──────────────┐  ┌─ Detail ───────────────────────────────────┐
│ ▼ disk0                  │  │  disk0                                      │
│   APPLE SSD AP0512Z      │  │  APPLE SSD AP0512Z                          │
│   500.3 GB  ✅ Verified  │  │  ┌──────────┐  Model: APPLE SSD AP0512Z     │
│   ├─ disk0s1  209.7 MB   │  │  │ Verified │  Serial: 05a1708611d9a02e    │
│   ├─ disk0s2  494.3 GB   │  │  │   ●───   │  Capacity: 500.3 GB           │
│   └─ disk0s3  5.4 GB     │  │  └──────────┘  Protocol: NVMe               │
│                           │  │               Temperature: 41°C             │
│ ▼ disk8                  │  │                                            │
│   HP SSD EX900 1TB       │  │  SMART Attributes                          │
│   1 TB        ✅ Verified │  │  ┌──────────────────────────────────────┐  │
│                           │  │  │ ID  Name                Cur  Thresh  │  │
│                           │  │  │ 200 Critical Warning    100      1 ✅│  │
│                           │  │  │ 201 Temperature           41     70 ✅│  │
│                           │  │  │ 202 Available Spare      100     99 ⚠│  │
│                           │  │  │ 204 Percentage Used      100     10 ✅│  │
│                           │  │  │ 205 Data Units Read  6,357,771   0  —│  │
│                           │  │  │ 210 Power Cycles         102      0  —│  │
│                           │  │  │ 211 Power On Hours        40      0  —│  │
│                           │  │  │ 212 Unsafe Shutdowns       4      1 ❌│  │
│                           │  │  └──────────────────────────────────────┘  │
└───────────────────────────┘  └────────────────────────────────────────────┘

Requirements

  • macOS 14.0 (Sonoma) or later
  • Swift 5.9+
  • Apple Silicon or Intel Mac

Quick Start

# Clone
git clone git@github.com:soranosoranosora/QDisk.git
cd QDisk

# Build & run
make build
make run

Build artifacts:

  • QDisk.app — macOS app bundle with icon
  • ./QDiskApp — standalone executable
  • SMARTDiag — CLI diagnostic tool (swift run SMARTDiag)

SMART Data Retrieved

NVMe (Log Page 0x02)

Field Description
Critical Warning Bitmask: spare-low, temp-warn, degraded, read-only, backup-failed
Composite Temperature Kelvin → Celsius
Available Spare Percentage remaining
Percentage Used 0 = new, 100 = worn out
Data Units Read / Written 512-byte units (×1000 for bytes)
Host Read / Write Commands Total commands issued
Controller Busy Time Minutes
Power Cycles / Power On Hours Lifetime counters
Unsafe Shutdowns Unexpected power-loss count
Media Errors / Error Log Entries Integrity error counters

ATA (SMART READ DATA)

30 attributes with normalized current/worst/threshold values and raw vendor data.

Architecture

Sources/
├── SMARTCore/              # Core library (no UI dependencies)
│   ├── SMARTInterface.swift # IOKit COM plugin vtable wrappers
│   ├── SMARTService.swift   # Device discovery & SMART reading pipeline
│   ├── ATACommand.swift     # ATA SMART / IDENTIFY parsing
│   ├── NVMeCommand.swift    # NVMe SMART log parsing
│   ├── L10n.swift           # Localization engine (en/zh-Hans/zh-Hant/ja)
│   └── Models/              # DiskInfo, SMARTAttribute, SMARTStatus
├── QDiskApp/               # SwiftUI GUI application
│   ├── Views/               # ContentView, DiskListView, DiskDetailView, etc.
│   └── ViewModel/           # SMARTViewModel + DiskTreeNode
└── SMARTDiag/              # CLI diagnostic tool

SMART Reading Pipeline

IOBSDNameMatching
  → Walk IORegistry parent chain → find SMART-capable node
    → IOCreatePlugInInterfaceForService (ATA or NVMe UUID)
      → COM QueryInterface → SMART interface vtable
        → SMARTReadData / GetLogPage / GetIdentifyData
          → Parse raw bytes → SMARTAttribute array

License

MIT License — see LICENSE file.


中文文档

About

Swift S.M.A.R.T. Information Reader for macOS

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors