Open
Conversation
Expose `f_frsize` from libuv's `uv_statfs_t` as `statfs.frsize`. Per POSIX, `f_blocks`, `f_bfree`, and `f_bavail` are expressed in units of `f_frsize`, not `f_bsize`. On most filesystems the two values are typically equal, but some filesystem drivers report a different `f_bsize`, making it impossible to compute accurate disk usage without `frsize`. Refs: libuv/libuv#4983
addaleax
approved these changes
Mar 16, 2026
Collaborator
juanarbol
approved these changes
Mar 16, 2026
lpinca
approved these changes
Mar 16, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62277 +/- ##
=======================================
Coverage 89.67% 89.67%
=======================================
Files 676 676
Lines 206555 206557 +2
Branches 39554 39546 -8
=======================================
+ Hits 185230 185236 +6
+ Misses 13461 13444 -17
- Partials 7864 7877 +13
🚀 New features to boost your workflow:
|
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.
Expose
f_frsizefrom libuv'suv_statfs_tasstatfs.frsize.libuv 1.52.0 added
f_frsizetouv_statfs_t, and this dependency update has already landed in Node.js (5bebd7e),so users can now compute accurate disk usage on every filesystem type.
Per POSIX,
f_blocks,f_bfree, andf_bavailare in units off_frsize, notf_bsize. On most filesystems the two values happen to be equal, soblocks * bsizegives a correct result. However, some filesystem drivers report a largerbsizeas the I/O transfer size whilefrsizeremains at the actual block size, producing a significant overestimation.I hit this on a Docker container using virtiofs with a bind-mounted host directory:
blocks × frsizeblocks × bsizeWithout
frsizeexposed, there is no way to work around this using the Node.js API alone.See also libuv/libuv#4983 where the same problem was discussed.