Free df(1) POSIX man page:
<total space>
[...] <space used>, <space free>, plus any space reserved
by the system not normally available to a user.
<space free>
[...] for the creation of new files by unprivileged users,
[...]
Note, Capacity remains unchanged because it shall be
<space used>/(<space used> + <space free>)
and it is maid explicitly clear that <space used> + <space free> shall not be
<total space>:
[...] This percentage may be greater than 100 if <space free> is less
than zero [...]
Signed-off-by: Mattias Andrée <[email protected]>
---
df.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/df.c b/df.c
index 4d595d6..245cca3 100644
--- a/df.c
+++ b/df.c
@@ -65,8 +65,8 @@ mnt_show(const char *fsname, const char *dir)
bs = s.f_frsize / blksize;
total = s.f_blocks * bs;
- avail = s.f_bfree * bs;
- used = total - avail;
+ avail = s.f_bavail * bs;
+ used = total - s.f_bfree * bs;
if (used + avail) {
capacity = (used * 100) / (used + avail);
--
2.24.0