Repository navigation
PhysicalDisk (Linux): adds drive health detection via udisks2 - #2728
Merged
Merged
Conversation
giovannilentini
force-pushed
the
physicaldisk-health
branch
from
November 16, 2026 21:10
92192c6 to
ce2dab9
Compare
CarterLi
reviewed
Nov 17, 2026
| FFPhysicalDiskWarning criticalWarning; | ||
| } FFPhysicalDiskResult; | ||
|
|
||
| static inline void ffPhysicalDiskInitHealth(FFPhysicalDiskResult* device) { |
Member
There was a problem hiding this comment.
We don't use ffModuleInitXxx. This may change in the future, but for now please follow the common pattern.
CarterLi
reviewed
Nov 17, 2026
| if (dev->availableSpare != FF_PHYSICALDISK_PERCENT_UNSET) { | ||
| ffStrbufAppendF(&spareStr, "%u%%", (unsigned) dev->availableSpare); | ||
| } | ||
| FF_STRBUF_AUTO_DESTROY warningStr = ffStrbufCreate(); |
Member
There was a problem hiding this comment.
Please use ffList with FFstrbuf, which is more friendly with lua script.
Contributor
Author
|
Done, fixed both. |
giovannilentini
force-pushed
the
physicaldisk-health
branch
from
November 17, 2026 05:50
ce2dab9 to
f514a0a
Compare
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in drive health to the
PhysicalDiskmodule, as discussed in #2726. This PR covers the shared part and Linux (NVMe via udisks2, no root needed). macOS, Windows and ATA can follow as separate PRs.{ "type": "physicaldisk", "health": true }Related issue (required for new logos for new distros)
Ref #2726
Changes
PhysicalDisk: adds health option and result fieldshealthoption (defaultfalse) andpercentcolor thresholds (default like Battery: green ≥ 50, red < 20)percentUsed,availableSpare,criticalWarning;criticalWarningbits 0-5 match the NVMe Critical Warning fieldpercent.type(number and/or bar), like Battery and DiskHealth <100 - percent used>%, and the warnings only if there are any{health},{percent-used},{available-spare},{critical-warning}; JSON schema updatedDBus: supports calling methods with an empty a{sv} argumentSmartGetAttributestakes ana{sv}options argument, whichdbus_message_append_argscan't build. Loadsdbus_message_iter_init_append/open_container/close_containerand addsffDBusGetMethodReplyEmptyDict()PhysicalDisk (Linux): adds health detection via udisks2healthis enabledNameHasOwnerfirst, so udisksd is never auto-started by fastfetchBlock.Drive→NVMe.Controller.SmartUpdated(skipped if udisks has no SMART data yet) →SmartCriticalWarning→SmartGetAttributes(percent_used,avail_spare)Performance (
-s physicaldisk, median of 31 runs, 2 NVMe disks):health: false(default)health: trueThere's no cost unless
healthis enabled. The extra ~1 ms is the D-Bus connection plus 4 calls per NVMe disk.Screenshots
{ "name": "Lexar SSD NM620 256GB", "interconnect": "NVMe", "kind": "SSD", "temperature": 34.85, "percentUsed": 3, "availableSpare": 100, "criticalWarning": [] }The values match
busctl --system call org.freedesktop.UDisks2 <drive> org.freedesktop.UDisks2.NVMe.Controller SmartGetAttributes 'a{sv}' 0and GNOME Disks.Checklist
ctest21/21,presets/all.jsonc,--format json,--gen-config(full)-DENABLE_DBUS=OFFShould macOS / Windows / ATA go into this PR or into follow-ups?