Subject: bug#39273: unwanted behavior in the combination of an scenario regarding btrfs, ssh, borg, and 'df' from the core utils

From: Wismerhill <[email-masked]>
Date: Fri, 24 Jan 2020 20:50:22 +0100

Hi, 

My Name is Phil, i found an unwanted behavior in the combination of an
scenario regarding

btrfs, ssh, borg, and 'df' from the core utils.

Scenario:
I want to setup a home server (OpenSuse 15.1 - with newer kernel
5.4.13-9).
I have 4 disks and want to use btrfs for a raid config (raid 5 for
data; raid 1 for metadata) resulting in 6,5 TB free space; NO Snapshots
enabled/used; NO Snapper).
The plan is that 3 clients (clients are same config like the server
(OpenSuse and kernel) back up their home folder via borg over ssh on
the raid of the server.
(about 650 GB and 500000 files each client)

What happend:
When i start a borg backup via ssh, it interrupt with the following
error message "Insufficient free space to complete transaction
(required: 116.30 MB, available: 0 B) FILENAME"
I did try some stuff, and at the end it looks like borg finishes withe
this error in because 'df' reports a wrong space calculation to ssh and
ssh tells borg to stop in because of that.

- the problem only apears in the combination of btrfs and a Raid 5 or 6
for data on the target. 
- on a special point when i move larger amount of data (some 100 of
GBs).

Solution / Request for help:
'df' can determin the FS-type, if df for example recognize the
filesystem it was asked for is btrfs, df 'ask' the btrfs-utils (btrfs
filesystem usage) for help/delegate the request (asumed that on a
system where a btrfs filesystem is, the coresponding tools are also
installed.

I don´t want to change the filesystem since btrfs-rescue convinced me.
But searching for answers i found out that many Admins didn´t use btrfs
in Raid 56 mode in because of fear of the writehole bug. 
This writehole bug is not that dangerous if i have the metadata
mirrored in raid 1.
And Borg is a cool solution with its deduplicating capabilities.
I use btrfs on every machine  and ssh (sftp) are my only used protokoll
for homenet dataexchange.

I hope you can provide a patch for it, since btrfs developed to a grade
where stabilitie and its features are truley an alternativ for ext4,
and i think its only a matter of time it will become the main
filesystem for linux.

I was also considerating to do it with aliases on the shell, but the
script have to be bigger to cover all possible Options and their
combinations. Also I´m not shure if that solution will not open other
failures since df is kind of historical and used as core in many ways
for a lot of programms e.g. ssh :-)

kind regards

Philipp Plato