Fix disk usage reporting by improving partition selection logic #144
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
This PR fixes the disk usage reporting issues where gtop would often display incorrect partition information by improving the partition selection logic in
disk.js.Problem
The original implementation simply used
data[0](the first filesystem returned by systeminformation), which often pointed to system partitions, swap files, or other irrelevant filesystems instead of the main user data partition. This caused significant discrepancies between gtop's reported disk usage and what users would see in system tools likedfor macOS Storage Management.Solution
The improved implementation:
/System/Volumes/Data(Catalina+), then/(root), then falls back to the largest filesystem/(root filesystem), then falls back to the largest filesystemIssues Fixed
This addresses several reported issues:
/) on Linux systems, matchingdfbehavior/System/Volumes/Datamount pointChanges Made
updateData()function inlib/monitor/disk.jsTesting
The changes have been tested to ensure:
This improvement makes gtop's disk usage reporting much more accurate and consistent with standard system tools.