Storage Volumes, APFS Containers & Capacity Telemetry #9
Notifications
Due Date
No due date set.
Blocks
Depends on
#10 Real-Time Disk I/O Throughput & IOPS Telemetry
gronod/MacMonitor
#24 Threshold Alerts & macOS Notification Center Integration
gronod/MacMonitor
Reference: gronod/MacMonitor#9
Reference in New Issue
Block a user
Purpose
Discover and monitor all mounted storage volumes, APFS containers, internal NVMe/PCIe SSDs, SATA drives, and external storage on Intel Macs, reporting accurate total, used, available, and purgeable capacity.
Priority
Critical (Essential storage monitoring and disk full prevention)
Dependencies
Scope
Implementation Suggestions
NSURLVolumeResourceValuesKeyandstatfsin Objective-C/Swift.NSURLVolumeAvailableCapacityForImportantUsageKeyandNSURLVolumeAvailableCapacityForOpportunisticUsageKeyfor accurate APFS capacity without misleading APFS snapshot overhead.NSWorkspace.didMountNotificationandNSWorkspace.didUnmountNotificationonNSWorkspace.shared.notificationCenterfor immediate mount state synchronization.gronod referenced this issue2026-09-08 10:28:41 +01:00
Technical Implementation Plan & Code Solution
1. APFS Volumes & Capacity Architecture
Under macOS Sonoma, APFS uses dynamic container sharing where multiple volumes share a common pool of free blocks. Traditional
statfsreporting can misrepresent APFS local snapshots as unavailable storage.To retrieve exact user-available capacity:
NSURLVolumeAvailableCapacityForImportantUsageKeyandNSURLVolumeAvailableCapacityForOpportunisticUsageKey.NSFileManagermounted volume resource values.2. Objective-C Provider (
MMStorageProvider.m)3. Swift UI Integration
4. Edge Cases Handled
NSVolumeEnumerationSkipHiddenVolumes.Completed in
feat/9-storage-volumesand merged intodevelop.MMStorageTelemetryProvidercalling BSDgetmntinfo.stat.f_bsize,f_blocks,f_bavail.MMStorageTests.swift.