Subject: du should warn about btrfs
From: Krzysztof Żelechowski <[email-masked]>
To: [email-masked]
Date: Mon, 26 Dec 2022 09:55:56 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

The tool du does not handle btrfs volumes correctly.  The total reported on my 
system is almost twice the volume capacity.  This is unexpected and should be 
indicated with a warning, both in the output and in the documentation.  Since 
the head of the output is often lost because it is not that important, the 
warning should be emitted at the end.

The total reported by { du /; } agrees on the total reported by { btrfs 
filesystem du /; } but the latter command also prints a shared size which is 
not paradoxical.  The problem with the tool btrfs is that it is a system 
command and not a user command so our code cannot just execute their code and 
be happy with it.  Also, their output is different because it has 3 columns as 
I mentioned earlier.

I understand that the total reported by { du /; } is still useful if one were 
to create an archive of the file system; such an archive would be much bigger 
than the file system itself and thus could not be restored unless the volume 
has lots of free space or the archiver itself is btrfs-aware, which I am 
afraid it is not.  The moral of this story apparently is that btrfs volumes 
cannot be reasonably archived using standard tools.