Fix storage totals for shared Arr filesystems#2721
Conversation
|
@nbellowe I've decided to help you fix this. 👍 |
|
Checks pass --> merge to |
|
Thanks @enoch85 ! I can test it locally as well, when I get a few minutes in the next week. |
Would be great! |
|
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
Hey @enoch85 there is still an issue if I have multiple containers, with different hostnames, and the same volumes and some double counts. I think we should remove the "hostname" from the key. Any objections? Happy to open up a PR. |
|
@nbellowe If you open a PR, use GPT 5.4 please. Test the changes locally first and make it tight, minimal and tell the AI to do fact based changes. 👍 That said, we want to keep hostnames. |
|
Not really sure how else to fix it (besides removing hostname, which has the issue of not supporting multi-host setups using the same disks on multiple hosts well). There doesn't appear to be additional disk metadata available to use for grouping. We could use "free disk space" but that could have issues as well. |
Please open a new issue and describe it as detailed as possible. |
Summary
Fix storage headline totals when Sonarr and Radarr expose multiple root-folder paths that all point at the same underlying filesystem.
This update now:
instanceType + instanceIdso Sonarr and Radarr IDs do not collideServarrApilabel + totalSpacewhen a stable volume label is presenttotalSpace + MiB-bucketed freeSpaceto absorb tiny cross-instance drift without collapsing obviously different same-size disksCloses #2720.
Root Cause
getDiskspaceWithRootFolders()can return multiple distinct paths like/movies,/tv, and/downloadsfor the same shared filesystem.Before this change,
computeTotals()deduped by normalized path, so those entries were summed independently even when they referred to the same media disk.Notes
Arr APIs do not expose a stable filesystem or device identifier in these payloads, so the totals logic still has to rely on a heuristic.
For accurate mounts without a label, the fallback now uses
totalSpace + MiB-bucketed freeSpaceas the filesystem signature. That fixes the shared-filesystem double-count while avoiding the strictertotalSpace-only collision on equal-capacity disks with materially different usage. Two separate unlabeled filesystems on the same host could still theoretically collide if they expose the same total space and land in the same free-space bucket.Validation
radarr(1)/sonarr(1)IDs not collidinggetRootFolders()returningundefinedin the shared Servarr helperyarn workspace @maintainerr/server test --runInBand src/modules/storage-metrics/storage-metrics.service.spec.ts src/modules/api/servarr-api/common/servarr-api.service.spec.tsyarn workspace @maintainerr/server tsc --noEmityarn workspace @maintainerr/server build