Garage reports wrong disk available size when run in systemd with DynamicUser=True
#611
Closed
opened 2 months ago by quentin
·
0 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Bug
In this example, Garage reports 213GB instead of 2.6TB.
The daemon is started by Systemd with
DynamicUser=True
set.Diagnostic
Garage uses the systemstat crate to fetch available space on a disk: https://github.com/valpackett/systemstat
And calls its mount() function: https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/main/src/rpc/system.rs#L894-L895
Then find the longest mount point that matches the beginning of the meta/data folders.
I think the mount points are not rewritten/scoped in systemd: if garage sees the /var/lib/garage/data folder, when it lists the mount points, it gets /var/lib/private/garage/data.
Possible solution
(quoting Linux Hackerman on Garage Matrix channel) ah yeah that seems wrong
it should probably statfs the data dir. I don't know what the portability requirements are on garage, but https://docs.rs/nix/latest/nix/sys/statvfs/index.html looks appropriate in principle