# \[BUG\] Incorrect disk usage statistics

**URL:** <https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 9, 2017, 9:57am UTC](https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207 "2017-10-09T09:57:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hogarthj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogarthj/32/22884_2.png) [@hogarthj](https://discuss.elastic.co/u/hogarthj)\
**Post date:** [October 9, 2017, 9:57am UTC](https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207/1 "2017-10-09T09:57:26Z")

</div>

Using metricbeat-5.6.0-1 on RHEL6 with a 5.6 ELK stack,

The metrics returned for system.filesystem.used.pct are incorrect.

The sigar go library returns the [raw results of statfs](https://github.com/elastic/gosigar/blob/master/sigar_unix.go) and the metricbeat code just [turns that into a flat percentage value](https://github.com/elastic/beats/blob/master/metricbeat/module/system/filesystem/helper.go#L73).

Unfortunately that does not take into account filesystem characteristics such as space allocated to metadata or root reserved amounts.

For an ext4 filesystem with default creation options, for instance, metricbeat will return 70% used whereas doing a df on the system will show 75% used, as df does included the reserved space and only returns regular free space.

Opening this topic for discussion as per the guidelines on github before filing an issue.

---

<div class="post-metadata">

**Author:** ![hogarthj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogarthj/32/22884_2.png) [@hogarthj](https://discuss.elastic.co/u/hogarthj)\
**Post date:** [November 1, 2017, 11:22am UTC](https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207/3 "2017-11-01T11:22:29Z")

</div>

Bug opened in GitHub: [https://github.com/elastic/beats/issues/5494](https://github.com/elastic/beats/issues/5494)

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [November 1, 2017, 8:06pm UTC](https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207/4 "2017-11-01T20:06:18Z")

</div>

I think I looked into this before and found that Metricbeat does not factor in the `available` value reported by statfs when it does its calculations. [Filesystem pct/used not same as reported by df](https://discuss.elastic.co/t/filesystem-pct-used-not-same-as-reported-by-df/71795/8?u=andrewkroh)

So you think we should change the calculation in the Metricbeat code? If so we should also check the Windows code to see if it has a similar problem.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2017, 8:06pm UTC](https://discuss.elastic.co/t/bug-incorrect-disk-usage-statistics/103207/5 "2017-11-29T20:06:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
