Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-2128

fact mountpoints does not correctly calculates mountpoint capacity

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • FACT 3.14.7
    • None
    • Night's Watch
    • 1
    • 2019-12-11
    • Needs Assessment
    • Bug Fix
    • Facter now takes into account the root-reserved space when reporting mountpoints (thanks to community member https://github.com/valia0906 for reporting and fixing this issue)
    • Needs Assessment

    Description

      I have (root /) mountpoint my df output looks:

      root@test:~# df /dev/sdb2
      Filesystem  1K-blocks   Used          Available   Use% Mounted on
      /dev/sdb2   19555608   15911760  2627432   86%    /

      df displays correct data as 86% used on this mountpoint.

      Fact mountpoints displays:

      root@test:~# facter mountpoints./

      { available => "3.48 GiB", available_bytes => 3731296256, capacity => "81.37%", device => "/dev/sdb2", filesystem => "ext4", options => [ "rw", "relatime", "errors=remount-ro", "stripe=32624", "data=ordered" ], size => "18.65 GiB", size_bytes => 20024942592, used => "15.17 GiB", used_bytes => 16293646336 }

      It displays only 81.37% of used space.

      I`ve read df manpage on http://manpages.ubuntu.com/manpages/trusty/man1/df.1posix.html which describes where to get differrent types of spaces and how to calculate used space. As a result I`ve created cpp file which correctly calculates available, free and used space. disk_usage.cpp

       I get output:
      fragment size 4096
      blocks size in f_frsize units 4888902
      free blocks 910962
      free blocks for unprivileged users: 656858
      total 19555608
      available: 2627432
      used: 15911760
      usedpercent: 85.827690

       

      I`ve already created pull request on git to solve this problem https://github.com/puppetlabs/facter/pull/1846

      Attachments

        Activity

          People

            Unassigned Unassigned
            valia0906 Valentyna
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support