GNU bug report logs - #60335
du should warn about btrfs

Previous Next

Package: coreutils;

Reported by: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>

Date: Mon, 26 Dec 2022 09:10:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>
Subject: bug#60335: closed (Re: bug#60335: du should warn about btrfs)
Date: Mon, 26 Dec 2022 18:43:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#60335: du should warn about btrfs

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 60335 <at> debbugs.gnu.org.

-- 
60335: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60335
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>
Cc: 60335-done <at> debbugs.gnu.org
Subject: Re: bug#60335: du should warn about btrfs
Date: Mon, 26 Dec 2022 10:42:27 -0800
[Message part 3 (text/plain, inline)]
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 (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>
To: bug-coreutils <at> gnu.org
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.





This bug report was last modified 2 years and 148 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.