I'm not a developer, but I think it goes something like this:
btrfs doesn't write the filesystem on the entire device/partition at
format time, rather, it dynamically increases the size of the
filesystem as data is used. That's why formating a disk in btrfs can
be so fast.

On Wed, Mar 23, 2011 at 12:39 PM, Brian J. Murrell
<br...@interlinx.bc.ca> wrote:
>
> On 11-03-06 11:06 AM, Calvin Walton wrote:
> >
> > To see exactly what's going on, you should use the "btrfs filesystem df"
> > command to see how space is being allocated for data and metadata
> > separately:
>
> OK.  So with an empty filesystem, before my first copy (i.e. the base on
> which the next copy will CoW from) df reports:
>
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/mapper/btrfs--test-btrfs--test
>                     922746880        56 922746824   1% /mnt/btrfs-test
>
> and btrfs fi df reports:
>
> Data: total=8.00MB, used=0.00
> Metadata: total=1.01GB, used=24.00KB
> System: total=12.00MB, used=4.00KB
>
> after the first copy df and btrfs fi df report:
>
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/mapper/btrfs--test-btrfs--test
>                     922746880 121402328 801344552  14% /mnt/btrfs-test
>
> root@linux:/mnt/btrfs-test# cat .snapshots/monthly.22/metadata/btrfs_df-stop
> Data: total=110.01GB, used=109.26GB
> Metadata: total=5.01GB, used=3.26GB
> System: total=12.00MB, used=24.00KB
>
> So it's clear that total usage (as reported by df) was 121,402,328KB but
> Metadata has two values:
>
> Metadata: total=5.01GB, used=3.26GB
>
> What's the difference between total and used?  And for that matter,
> what's the difference between the total and used for Data
> (total=110.01GB, used=109.26GB)?
>
> Even if I take the largest values (i.e. the total values) for Data and
> Metadata (each converted to KB first) and add them up they are:
> 120,607,211.52 which is not quite the 121,402,328 that df reports.
> There is a 795,116.48KB discrepancy.
>
> In any case, which value from a btrfs df fi should I be subtracting from
> df's accounting to get a real accounting of the amount of data used?
>
> Cheers,
> b.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to