linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Zoltán <zoltan1980@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: Disk usage difference in the output of `btrfs fi show` vs. `btrfs fi du`
Date: Sun, 28 Mar 2021 20:19:08 +0300	[thread overview]
Message-ID: <eb075afb-e9ca-5783-f8a2-1bd6b1192dd7@gmail.com> (raw)
In-Reply-To: <CAGtRCvfHfjFFZZQCEHR+ff-JfNCCOMq=B0PxaCc-_+a6XKEg+A@mail.gmail.com>

On 28.03.2021 15:28, Zoltán wrote:
> 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

It probably does not take in account exclusive usage of other
subvolumes, likely snapshots.

> 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
> 


      reply	other threads:[~2021-03-28 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb075afb-e9ca-5783-f8a2-1bd6b1192dd7@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zoltan1980@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).