Repository navigation
PhysicalDisk (macOS / Windows): adds drive health detection - #2731
Open
giovannilentini wants to merge 2 commits into
Open
giovannilentini wants to merge 2 commits into
giovannilentini wants to merge 2 commits into
Conversation
This branch has not been deployed
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
Follow-up to #2728: adds the opt-in drive health detection from #2726 on macOS and Windows (NVMe). The option, fields, format args and output are the same as on Linux; only detection is new.
{ "type": "physicaldisk", "health": true }Related issue (required for new logos for new distros)
Ref #2726
Changes
PhysicalDisk (macOS): adds health detectionSMARTReadData()now fills temperature (temp) andPERCENTAGE_USED/AVAILABLE_SPARE/CRITICAL_WARNING(health)temp || health, so enabling both costs the same astempalonePhysicalDisk (Windows): adds health detectionBusTypeNvme), only whenhealthis enabledIOCTL_STORAGE_QUERY_PROPERTYwithStorageDeviceProtocolSpecificProperty/ProtocolTypeNvme/NVMeDataTypeLogPage/NVME_LOG_PAGE_HEALTH_INFO, read fromNVME_HEALTH_INFO_LOGFILE_READ_ATTRIBUTEShandle, no admin needed (tested)Linux / macOS / WindowsScreenshots
macOS (MacBook Air 2020, Intel/T2, macOS 15.7.9):
Windows 11 (build 26300, inbox
stornvme, non-admin):Values match
smartctl -a disk0on macOS (used 7%, spare 100%, warning 0x00), and on Windows they match udisks2 on Linux for the same two drives (dual boot: used 3 / 0, spare 100, no warnings).Performance (
-s physicaldisk, median of 31 runs):temphealthtemp+healthNo cost unless
healthis enabled. On Windows the drive takes about 5.7 ms per disk to answer the log page request, which is still less than the existingtempquery.Checklist
ctest22/22Not tested: Apple Silicon Macs and Windows vendor NVMe drivers. If someone can run fastfetch there with
{ "type": "physicaldisk", "health": true }in their config, that would help.Planned next, as a separate small PR: the SMART "failing" status for SATA/ATA disks (Linux, via udisks2). No percentage there, since SATA has no standard for it.