linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Disk usage difference in the output of `btrfs fi show` vs. `btrfs fi du`
@ 2021-03-28 12:28 Zoltán
  2021-03-28 17:19 ` Andrei Borzenkov
  0 siblings, 1 reply; 2+ messages in thread
From: Zoltán @ 2021-03-28 12:28 UTC (permalink / raw)
  To: linux-btrfs

Hi,

I have read a lot of caveats about interpreting the free space
reported for btrfs volumes, but could not find anything about the
perceived inconsistency in the disk usage reporting described below.

I have a btrfs volume with about 135GiB used for data, as reported by
`df`, `btrfs fi show` and `btrfs fi usage` alike:

# btrfs filesystem show /volumes/main/
Label: 'main'  uuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        Total devices 1 FS bytes used 134.12GiB
        devid    1 size 193.43GiB used 165.01GiB path /dev/sda2

However, `btrfs fi du` reports ~17GiB exclusive usage and ~80GiB
shared usage, which adds up to only 97GiB (compared to the 135GiB I
would expect):

# btrfs filesystem du -s /volumes/main/
     Total   Exclusive  Set shared  Filename
   1.73TiB    17.20GiB    80.13GiB  /volumes/main/

(The reported total usage exceeding the disk capacity by an order of
magnitude is expected as the volume contains many snapshots.)

The mount point corresponds to the root subvolume, thus all subvolumes
should be accounted for by `btrfs fi du` (according to its
documentation):

# mount | grep /volumes/main
/dev/sda2 on /volumes/main type btrfs
(rw,noatime,ssd,space_cache,autodefrag,subvolid=5,subvol=/)

Do I misunderstand the meaning of exclusive and shared usage or is
there some other issue causing this behaviour? I would expect the disk
usage reported by `df`, `btrfs fi show` and `btrfs fi usage` to be the
sum of the exclusive and shared usage reported by `btrfs fi du`.

The output of `btrfs fi usage`, for completeness's sake:

# btrfs filesystem usage /volumes/main/
Overall:
    Device size:                 193.43GiB
    Device allocated:            165.01GiB
    Device unallocated:           28.41GiB
    Device missing:                  0.00B
    Used:                        134.12GiB
    Free (estimated):             57.00GiB      (min: 57.00GiB)
    Data ratio:                       1.00
    Metadata ratio:                   1.00
    Global reserve:              194.72MiB      (used: 0.00B)

Data,single: Size:162.00GiB, Used:133.41GiB (82.35%)
   /dev/sda2                     162.00GiB

Metadata,single: Size:3.01GiB, Used:720.88MiB (23.41%)
   /dev/sda2                       3.01GiB

System,single: Size:4.00MiB, Used:48.00KiB (1.17%)
   /dev/sda2                       4.00MiB

Unallocated:
   /dev/sda2                      28.41GiB

Thanks,

Zoltan

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

end of thread, other threads:[~2021-03-28 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-28 12:28 Disk usage difference in the output of `btrfs fi show` vs. `btrfs fi du` Zoltán
2021-03-28 17:19 ` Andrei Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).