--- Begin Message ---
Subject: |
du should warn about btrfs |
Date: |
Mon, 26 Dec 2022 09:55:56 +0100 |
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.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#60335: du should warn about btrfs |
Date: |
Mon, 26 Dec 2022 10:42:27 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 12/26/22 00:55, Krzysztof Żelechowski wrote:
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.
Although we can document the issue, I don't think a warning is needed.
Nor is it implementable, since there's no reliable way to know whether
copy-on-write, compression, etc. are affecting the numbers the operating
system is reporting.
Perhaps in some distant future the kernel, Btrfs, ZFS etc. can find a
way to report underlying space usage in a better way. For example, if
CoW is being used for a page they might divide the page's size by the
number of times it's used. Whatever. In the meantime the best we can do
is document the issue, which I've attempted to do by installing the
attached patch.
Thanks for reporting the problem.
0001-doc-improve-doc-of-du-with-CoW-etc.patch
Description: Text Data
--- End Message ---