All of lore.kernel.org
 help / color / mirror / Atom feed
* du --bytes show different value for btrfs and e.g. ext4 with identical data
@ 2022-08-13  0:11 Christoph Anton Mitterer
  2022-08-13  7:30 ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Anton Mitterer @ 2022-08-13  0:11 UTC (permalink / raw)
  To: linux-btrfs

Hey.

Forgive me if that has been answered before, but I couldn't find it on
the list or the manpage.

I have my personal data on several backup disks, all of them except one
(which is ext4) being btrfs.

The data on them is 100% identical (diff -qr --no-dereference brought
no difference). On the btrfs, the whole data is always in one
subvolume.


Yet, when I do:
  du --bytes (which implies --apparent-size)
I get (in my case):
  5035634863728 for (all the) btrfs
but
  5035836693616 for the ext4

Which is some 192 MiB more on ext4.


Because of --apparent-size, this shouldn't be any refcopy or
compression effects; also hardlinks shouldn't matter (and are the same
on all of the filesystems anyway).


Any idea why the results are different and shouldn't they be the same?
And if not, would it make sense to have this behaviour added to
btrfs(5)?


Thanks,
Chris.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: du --bytes show different value for btrfs and e.g. ext4 with identical data
  2022-08-13  0:11 du --bytes show different value for btrfs and e.g. ext4 with identical data Christoph Anton Mitterer
@ 2022-08-13  7:30 ` Andrei Borzenkov
  2022-08-13 19:29   ` Christoph Anton Mitterer
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2022-08-13  7:30 UTC (permalink / raw)
  To: Christoph Anton Mitterer, linux-btrfs

On 13.08.2022 03:11, Christoph Anton Mitterer wrote:
> Hey.
> 
> Forgive me if that has been answered before, but I couldn't find it on
> the list or the manpage.
> 
> I have my personal data on several backup disks, all of them except one
> (which is ext4) being btrfs.
> 
> The data on them is 100% identical (diff -qr --no-dereference brought
> no difference). On the btrfs, the whole data is always in one
> subvolume.
> 
> 
> Yet, when I do:
>   du --bytes (which implies --apparent-size)
> I get (in my case):
>   5035634863728 for (all the) btrfs
> but
>   5035836693616 for the ext4
> 
> Which is some 192 MiB more on ext4.
> 
> 
> Because of --apparent-size, this shouldn't be any refcopy or
> compression effects; also hardlinks shouldn't matter (and are the same
> on all of the filesystems anyway).
> 
> 
> Any idea why the results are different and shouldn't they be the same?

You did not show your actual command which makes it impossible for
anyone to reproduce it. But my guess is that your du invocation includes
size of directories which is different between different filesystems.

> And if not, would it make sense to have this behaviour added to
> btrfs(5)?
> 
> 
> Thanks,
> Chris.
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: du --bytes show different value for btrfs and e.g. ext4 with identical data
  2022-08-13  7:30 ` Andrei Borzenkov
@ 2022-08-13 19:29   ` Christoph Anton Mitterer
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Anton Mitterer @ 2022-08-13 19:29 UTC (permalink / raw)
  To: Andrei Borzenkov, linux-btrfs

On Sat, 2022-08-13 at 10:30 +0300, Andrei Borzenkov wrote:
> 
> You did not show your actual command which makes it impossible for
> anyone to reproduce it. But my guess is that your du invocation
> includes
> size of directories which is different between different filesystems.

Ah... yes that's the reason.
Unfortunately du has no built-in option to exclude the dirs and count
only the sizes of regular files

But one can do e.g.:
$ find . -type f -print0  | du --apparent-size -l -c -s --block-size=1 --files0-from=-

Thanks,
Chris.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-13 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13  0:11 du --bytes show different value for btrfs and e.g. ext4 with identical data Christoph Anton Mitterer
2022-08-13  7:30 ` Andrei Borzenkov
2022-08-13 19:29   ` Christoph Anton Mitterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.