Skip to content

Conversation

@mattleaverton
Copy link
Contributor

@mattleaverton mattleaverton commented Feb 12, 2026

Summary

Fixes #12

  • Replace sysinfo crate's disk space calculation with direct libc::statvfs call on Unix
  • Correctly uses f_frsize instead of f_bsize, fixing 256x inflation on VirtioFS mounts (Docker Desktop)
  • Non-Unix platforms fall back to the existing sysinfo implementation

Test plan

  • Unit tests for disk space function (sane values, nonexistent path)
  • Manual verification in Docker Desktop container: dashboard shows ~927 GiB instead of 231 TiB
  • All 59 existing tests pass

🤖 Generated with Claude Code

mattleaverton and others added 2 commits February 12, 2026 13:40
The sysinfo crate's Disks API multiplies block counts by f_bsize instead
of f_frsize, inflating reported disk space by 256x on VirtioFS mounts
(Docker Desktop) where f_bsize=1MiB but f_frsize=4KiB. This caused the
dashboard to show 231 TiB instead of 927 GiB.

Replace the sysinfo-based disk_space_for_path with direct libc::statvfs
on Unix, correctly using f_frsize for block size calculations. Keep the
sysinfo fallback for non-Unix platforms.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The statvfs struct fields (f_blocks, f_bavail, f_frsize) are u32 on
macOS but u64 on Linux. The casts are needed for portability but
trigger clippy::unnecessary_cast on Linux CI.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storage stats report 231 TiB on VirtioFS (Docker Desktop)

1 participant