<p>In Debian we got reported (<a href="https://bugs.debian.org/800345">https://bugs.debian.org/800345</a>) the following bugreport by Klaus Ethgen:</p>

<p>Since several days, one of my checks went red for one of my boxes,<br>
mentioned that / is 100% full. But this is not true, there is plenty of<br>
space left.</p>

<p>~> df -Th<br>
   Filesystem               Type      Size  Used Avail Use% Mounted on<br>
   /dev/sda1                btrfs     502M  338M  169M  67% /<br>
   ...</p>

<p>~> btrfs fi df /<br>
   System, single: total=4.00MiB, used=4.00KiB<br>
   Data+Metadata, single: total=497.81MiB, used=329.71MiB<br>
   GlobalReserve, single: total=8.00MiB, used=0.00B</p>

<p>~> /usr/lib/nagios/plugins/check_disk -w '3%' -c '1%'<br>
   DISK CRITICAL - free space: / 0 MB (0% inode=-)]; ...</p>

<p>~> grep ' / ' /proc/mounts<br>
   /dev/sda1 / btrfs rw,nodiratime,relatime,compress=zlib,ssd,discard,space_cache,autodefrag 0 0</p>

<p>All other partitions worked well but it constantly shows / to be full.</p>

<p>~> /usr/lib/nagios/plugins/check_disk -w '3%' -c '1%' -vvv<br>
   Thresholds(pct) for / warn: 3,000000 crit 1,000000<br>
   calling stat on /<br>
   For /, used_pct=100 free_pct=0 used_units=337 free_units=0 total_units=501 used_inodes_pct=-1 free_inodes_pct=101 fsp.fsu_blocksize=4096 mult=1048576<br>
   Freespace_units result=0<br>
   Freespace% result=2<br>
   Usedspace_units result=0<br>
   Usedspace_percent result=0<br>
   Usedinodes_percent result=0<br>
   Freeinodes_percent result=0</p>

<p>And to give you what stat gives:<br>
   ~> stat -f /<br>
     File: "/"<br>
       ID: a446833a80ceeb6a Namelen: 255     Type: btrfs<br>
   Block size: 4096       Fundamental block size: 4096<br>
   Blocks: Total: 128472     Free: 42014      Available: 43031<br>
   Inodes: Total: 0          Free: 0</p>

<p>I think, I found the bug.</p>

<p>line 1044:<br>
   p->available = fsp->fsu_bavail > fsp->fsu_bfree ? 0 : fsp->fsu_bavail;</p>

<p>But from the stat I see that:<br>
   ... Free: 41708      Available: 42725</p>

<p>I think, that BDE^HD workarround here is broken for btrfs and maybe<br>
other filesystems that supports compression.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br><a href="https://github.com/monitoring-plugins/monitoring-plugins/issues/1357">Reply to this email on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFQl2ZBK109LqamVom7snfaJ75EbLfSaks5o2962gaJpZM4GGgC1.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/monitoring-plugins/monitoring-plugins/issues/1357"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>