Repository navigation
Open
Description
Description
Add an opt-in drive health readout to the PhysicalDisk module, next to the existing temp option. The data would come from SMART / the NVMe health log.
Proposed option (off by default, like temp):
{ "type": "physicaldisk", "temp": true, "health": true }New format args. Each one is left empty when the data isn't available:
| Arg | Source | Example |
|---|---|---|
{health} |
100 − NVMe Percentage Used (same value GNOME Disks / CrystalDiskInfo show as health) |
97% |
{percent-used} |
NVMe Percentage Used (raw) | 3% |
{available-spare} |
NVMe Available Spare | 100% |
{critical-warning} |
NVMe Critical Warning bits / ATA SMART overall status | none, spare below threshold, failing |
Example output (default format would only show the warning when it isn't "none"):
Physical Disk (Lexar SSD NM620 256GB): 238.47 GiB [SSD, NVMe] - 35°C - Health 97%
Physical Disk (WDC WD20EZRZ): 1.82 TiB [HDD, SATA] - SMART failing
Possible sources without root:
- macOS:
physicaldisk_apple.calready callsSMARTReadData()for the temperature. The sameNVMeSMARTDatastruct hasCRITICAL_WARNING,PERCENTAGE_USEDandAVAILABLE_SPARE, so NVMe support adds almost nothing. - Windows:
IOCTL_STORAGE_QUERY_PROPERTY(already used forStorageDeviceTemperatureProperty) withStorageDeviceProtocolSpecificProperty/NVMeDataTypeLogPagefor the NVMe SMART log. Fallback:MSFT_PhysicalDisk.HealthStatusvia WMI. - Linux: reading SMART directly (SG_IO, NVMe admin commands) needs root. udisks2 exposes it over D-Bus without root:
org.freedesktop.UDisks2.Drive.Ata.SmartFailingfor ATA. For NVMe (udisks ≥ 2.10), theorg.freedesktop.UDisks2.NVMe.Controllerinterface has theSmartCriticalWarningproperty, and theSmartGetAttributes()method returnspercent_used,avail_spareandmedia_errors. I tested this as a normal user on Fedora with two NVMe drives:This would use the existing optional$ busctl --system call org.freedesktop.UDisks2 /org/freedesktop/UDisks2/drives/Lexar_SSD_NM620_256GB_... \ org.freedesktop.UDisks2.NVMe.Controller SmartGetAttributes 'a{sv}' 0 ... "avail_spare" y 100 ... "percent_used" y 3 ... "media_errors" t 0 ...ENABLE_DBUSsupport, and the fields would just stay empty when udisks isn't running. - BSD / others: not supported at first.
Motivation
Drive wear and pending failure are hardware-level facts that fit next to size, type and temperature. NVMe wear in particular is something users want to see at a glance.
Why Command doesn't do the job:
smartctlneeds root for most devices, so acommandmodule runningsmartctlfails or prompts for sudo.- The output differs between platforms and between ATA and NVMe, so a portable script is fragile.
- Spawning
smartctlonce per disk is much slower than reading data fastfetch already partly fetches (macOS, Windows).
Additional context
Questions for the maintainers before I start on a PR:
- Is
healthas a PhysicalDisk option (off by default) the right approach, or would you prefer a separate module? - On Linux, is a D-Bus call to udisks2 acceptable for an opt-in field?
- Are the field names and JSON keys above OK?
I'd start with macOS (smallest change), then Windows, then Linux.
Metadata
Metadata
Assignees
Labels
No labels
Activity
CarterLi commentedon Nov 16, 2026
Seems a good idea to me. As long as the performance cost of this feature is acceptable, I am ok to accept this.
giovannilentini commentedon Nov 16, 2026
Thanks I'll start working on it and then let you know.
PhysicalDisk: adds health option and result fields
DBus: supports calling methods with an empty a{sv} argument
PhysicalDisk (Linux): adds health detection via udisks2
PhysicalDisk: adds health option and result fields
DBus: supports calling methods with an empty a{sv} argument
PhysicalDisk (Linux): adds health detection via udisks2
PhysicalDisk: adds health option and result fields
DBus: supports calling methods with an empty a{sv} argument
PhysicalDisk (Linux): adds health detection via udisks2
PhysicalDisk (macOS): adds health detection
PhysicalDisk (Windows): adds health detection
PhysicalDisk (macOS): adds health detection
PhysicalDisk (Windows): adds health detection
giovannilentini commentedon Nov 17, 2026
Thanks for merging #2728 and #2731. I have one small follow-up ready on Linux, ATA/SATA disks report the SMART "failing" status (from udisks2) as a failing critical warning. There's no standard wear percentage for SATA, so that's the only thing it adds. Should that PR close this issue, or would you rather close it now?
CarterLi commentedon Nov 18, 2026
Better to support it in both Windows and macOS
giovannilentini commentedon Nov 18, 2026
Ok ok I'll try. My only concern is whether those OSs need admin rights for the SATA SMART status, but in any case I'll let you know