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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60335 in the body.
You can then email your comments to 60335 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#60335; Package coreutils. (Mon, 26 Dec 2022 09:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 26 Dec 2022 09:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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.






Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 26 Dec 2022 18:43:01 GMT) Full text and rfc822 format available.

Notification sent to Krzysztof Żelechowski <giecrilj <at> stegny.2a.pl>:
bug acknowledged by developer. (Mon, 26 Dec 2022 18:43:01 GMT) Full text and rfc822 format available.

Message #10 received at 60335-done <at> debbugs.gnu.org (full text, mbox):

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 1 (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)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Jan 2023 12:24:04 GMT) Full text and rfc822 format available.

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.