GNU bug report logs - #38621
gdu showing different sizes

Previous Next

Package: coreutils;

Reported by: TJ Luoma <luomat <at> gmail.com>

Date: Sun, 15 Dec 2019 08:42:02 UTC

Severity: normal

Tags: notabug

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: TJ Luoma <luomat <at> gmail.com>
Cc: 38621 <at> debbugs.gnu.org
Subject: Re: bug#38621: gdu showing different sizes
Date: Tue, 17 Dec 2019 00:38:11 +0100
On 2019-12-16 20:43, TJ Luoma wrote:
> AHA! Ok, now I understand a little better. I have seen the difference
> between "size" and "size on disk" and did not realize that applied
> here.

Thanks for confirming.

> I'm still not 100% clear on _why_ two "identical" files would have
> different results for "size on disk" (it _seems_ like those should be
> identical) but I suspect that the answer is probably of a technical
> nature that would be "over my head" so to speak, and truthfully, all I
> really need to know is "sometimes that happens" rather than
> understanding the technical details of why.

Actually the difference is a matter of choice, i.e., how the user wants to
save the file (obviously, most programs come with a certain default preference).

Suppose one writes a file with an "A" at the beginning, then e.g. 1.000.000 NUL
characters, and then a "B".

Then the storing algorithm may decide to either explicitly write all NULs
separately (here displayed as '.') to disk; e.g. 'cp --sparse=never' would do so:

  - write "A",
  - write 1.000.000 times a NUL,
  - write "B".

or to try to save some disk space by writing it as a "sparse" file;
e.g. 'cp --sparse=always' would (try to) do so:

  - write an "A",
  - then tell the filesystem that there are 1.000.000 NULs
    (which takes just a few bytes physically),
  - write a "B"

The latter method needs support from both the tool and the file system
where the file is stored.

Or with your words: "sometimes that happens". ;-)

> I appreciate you taking the time to educate me further about this.

No worries.  If there's one user who got confused, then there is
the chance that also others might fall into the same issue.
Therefore, if you think we could improve something, e.g. a clarifying
word in the documentation, then this would help us all.

Thanks & have a nice day,
Berny




This bug report was last modified 5 years and 157 days ago.

Previous Next


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