On Thu, Dec 5, 2019 at 7:04 PM Tomasz Chmielewski <mangoo@xxxxxxxx> wrote: > > I know that "df -h" is not to be trusted with btrfs, but some userspace > tools (i.e. apt, monitoring checks) rely on it. > > Sometimes, "df -h" will report 100% disk usage on a btrfs filesystem, > while there is still space available and writes are possible. > > Linux 5.4.1, LXD containers located in /data: > > # df -h > /dev/nvme1n1 1000G 571G 0 100% /data > > # btrfs fi usage /data > Overall: > Device size: 1000.00GiB > Device allocated: 580.02GiB > Device unallocated: 419.98GiB > Device missing: 0.00B > Used: 570.06GiB > Free (estimated): 429.45GiB (min: 429.45GiB) > Data ratio: 1.00 > Metadata ratio: 1.00 > Global reserve: 512.00MiB (used: 0.00B) It does look like a bug. But I'm not sure if this is expected, I thought such significant disagreements were long since fixed. What version of coreutils? Maybe attach a strace of df? (I'm not sure of the list attach size limit but it's preferred, but something like a pastebin is OK also) And maybe this will be useful for a dev? # grep -r . /sys/fs/btrfs/<fs-uuid>/allocation/ You'll need to use the correct fs uuid for the btrfs in question. > Data,single: Size:578.01GiB, Used:568.54GiB > /dev/nvme1n1 578.01GiB df seems to be treating only unallocated space as free, rather than both unallocated and allocated that is unused. Color me surprised. -- Chris Murphy
