On 2018-10-15 10:42, Anton Shepelev wrote:
Hugo Mills to Anton Shepelev:

While trying to resolve free space problems, and found
that I cannot interpret the output of:

btrfs filesystem show

Label: none  uuid: 8971ce5b-71d9-4e46-ab25-ca37485784c8
        Total devices 1 FS bytes used 34.06GiB
        devid    1 size 40.00GiB used 37.82GiB path /dev/sda2

How come the total used value is less than the value
listed for the only device?

   "Used" on the device is the mount of space allocated.
"Used" on the FS is the total amount of actual data and
metadata in that allocation.

   You will also need to look at the output of "btrfs fi
df" to see the breakdown of the 37.82 GiB into data,
metadata and currently unused.

See
https://btrfs.wiki.kernel.org/index.php/FAQ#Understanding_free_space.2C_using_the_original_tools
 for the details

Thank you, Hugo, understood.  mount/amount is a very fitting
typo :-)

Does the standard `du' tool work correctly for btfrfs?

For the default 'physical usage' mode, it functionally does not work correctly, because it does not know about reflinks. The easiest way to see this is to create a couple of snapshots of a subvolume alongside the subvolume, and then run `du -s --totals` on those snapshots and the subvolume. It will report the total space usage to be equal to the sum of the values reported for each snapshot and the subvolume, when it should instead only count the space usage for shared data once.

For the 'apparent usage' mode provided by the GNU implementation, it does work correctly.

Reply via email to