From 138f5faed87cc4150ac117d34280dbf69a63eed5 Mon Sep 17 00:00:00 2001 From: NBonaparte Date: Wed, 6 Sep 2017 17:06:55 -0700 Subject: [PATCH] fix(fs): Calculate used, percentages according to df Fixes #710. --- src/modules/fs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/fs.cpp b/src/modules/fs.cpp index 875cb0a6..a8e6f8ea 100644 --- a/src/modules/fs.cpp +++ b/src/modules/fs.cpp @@ -98,11 +98,11 @@ namespace modules { mount->bytes_total = buffer.f_bsize * buffer.f_blocks; mount->bytes_free = buffer.f_bsize * buffer.f_bfree; - mount->bytes_used = mount->bytes_total - buffer.f_bsize * buffer.f_bavail; + mount->bytes_used = mount->bytes_total - mount->bytes_free; mount->bytes_avail = buffer.f_bsize * buffer.f_bavail; - mount->percentage_free = math_util::percentage(mount->bytes_avail, mount->bytes_total); - mount->percentage_used = math_util::percentage(mount->bytes_used, mount->bytes_total); + mount->percentage_free = math_util::percentage(mount->bytes_avail, mount->bytes_used + mount->bytes_avail); + mount->percentage_used = math_util::percentage(mount->bytes_used, mount->bytes_used + mount->bytes_avail); } }