Title: Missing fields in fs struct results in downstream incorrect storage calculation · Issue #4983 · libuv/libuv · GitHub
Open Graph Title: Missing fields in fs struct results in downstream incorrect storage calculation · Issue #4983 · libuv/libuv
X Title: Missing fields in fs struct results in downstream incorrect storage calculation · Issue #4983 · libuv/libuv
Description: Per POSIX
Open Graph Description: Per POSIX
X Description: Per POSIX <sys/statvfs.h> (ref), f_blocks, f_bfree, and f_bavail are defined as being "in units of f_frsize", not f_bsize. Currently uv_statfs_t only exposes f_bsize, causing consum...
Opengraph URL: https://github.com/libuv/libuv/issues/4983
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing fields in fs struct results in downstream incorrect storage calculation","articleBody":"Per POSIX \u003csys/statvfs.h> ([ref](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html)), f_blocks, f_bfree, and f_bavail are defined as being \"in units of f_frsize\", not f_bsize. \n\nCurrently uv_statfs_t only exposes f_bsize, causing consumers to calculate incorrect disk space on filesystems where these values differ (macOS APFS, ZFS, CephFS, Docker Desktop virtiofs). \n\nI noticed this issue while debugging [immich#4318](https://github.com/immich-app/immich/issues/4318). Immich [uses bsize](https://github.com/immich-app/immich/blob/3321c1a9dfa8f483cbb011cdb5617a3b0b61d239/server/src/repositories/storage.repository.ts#L173-L180) to calculate total, free and available disk space:\n\n```typescript\n async checkDiskUsage(folder: string): Promise\u003cDiskUsage> {\n const stats = await fs.statfs(folder);\n return {\n available: stats.bavail * stats.bsize,\n free: stats.bfree * stats.bsize,\n total: stats.blocks * stats.bsize,\n };\n }\n```\n\nThis confusion between bsize and frsize has caused bugs in multiple projects including [borgbackup#4289](https://github.com/borgbackup/borg/issues/4289), [cockroachdb#61182](https://github.com/cockroachdb/cockroach/issues/61182), and the fix is [straightforward](https://github.com/borgbackup/borg/commit/2db84eada026e95575591cb27fe682af6a7986d9). But it is not possible to fix on node without the right field being exposed.\n\n","author":{"url":"https://github.com/ezequielp","@type":"Person","name":"ezequielp"},"datePublished":"2026-01-01T17:40:33Z","url":"https://github.com/libuv/libuv/issues/4983"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:52a382f0-b30b-b67a-de3b-423f28ceeb5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4E2:36C426:1AE15D:2593EA:6AEDAC07 |
| html-safe-nonce | 8b11c9b9ef2b20328d163a9758c872259513b6294e1fb8361fc2a41ed135ea3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEUyOjM2QzQyNjoxQUUxNUQ6MjU5M0VBOjZBRURBQzA3IiwidmlzaXRvcl9pZCI6IjczMTU2MTEyMzAwNjU3NjUzODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2027cf6e8f7285dc52b9b712a14a0a57bcd2f72e2a79de2eb8fba6e80087f6c7 |
| hovercard-subject-tag | issue:3774952639 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libuv/libuv/4983/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df39e52c2d56593203b2c1090d5ad87886e694f495c12dc7010b87fb76a51d72/libuv/libuv/issues/4983 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df39e52c2d56593203b2c1090d5ad87886e694f495c12dc7010b87fb76a51d72/libuv/libuv/issues/4983 |
| og:image:alt | Per POSIX |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ezequielp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9f51e3b6c7a190e426e641ae15acbc58dd1ac2003e96b58879bbc298e213dbf3 |
| turbo-cache-control | no-preview |
| go-import | github.com/libuv/libuv git https://github.com/libuv/libuv.git |
| octolytics-dimension-user_id | 4030929 |
| octolytics-dimension-user_login | libuv |
| octolytics-dimension-repository_id | 14812739 |
| octolytics-dimension-repository_nwo | libuv/libuv |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14812739 |
| octolytics-dimension-repository_network_root_nwo | libuv/libuv |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7060660810b587033ea861b8aa67beb72c8e6542 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width