This discussion is archived
3 Replies Latest reply: Oct 30, 2012 2:01 AM by Avi Miller RSS

Understanding btrfs filesystem output

Dude! Guru
Currently Being Moderated
Could someone please explain the following output:

It seems to me that btrfs fi df does not show the the total and available size disk space. What does the output actually mean? What is total, used and DUP?


[root@vm004 ~]# btrfs filesystem df /
Data: total=4.01GB, used=2.67GB
System, DUP: total=8.00MB, used=4.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=1.00GB, used=141.72MB
Metadata: total=8.00MB, used=0.00


What does the following tell us. I guess 2.67GB + 142 MB = 2.81 GB?

[root@vm004 ~]# btrfs fi show
Label: 'root' uuid: e88be872-eb9b-482f-bac2-7bde7235d946
     Total devices 1 FS bytes used 2.81GB
     devid 1 size 15.84GB used 6.04GB path /dev/sda3

Why 6.04 GB used?

[root@vm004 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 3.0G 12G 21% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda1 485M 119M 341M 26% /boot

Thanks!
  • 1. Re: Understanding btrfs filesystem output
    Avi Miller Guru
    Currently Being Moderated
    Dude wrote:
    It seems to me that btrfs fi df does not show the the total and available size disk space. What does the output actually mean? What is total, used and DUP?
    Correct, it only shows what is allocated and used.
    [root@vm004 ~]# btrfs filesystem df /
    Data: total=4.01GB, used=2.67GB
    You have 4.01GB of data space allocated and have used 2.67GB of it.
    System, DUP: total=8.00MB, used=4.00KB
    System: total=4.00MB, used=0.00
    You are running with your system data in DUP mode (duplicated data on a single device). Btrfs has allocated 8MB of total duplicated system data and used 4kb of it so far. It has also allocated 4MB of unduplicated system data, but has not used any.
    Metadata, DUP: total=1.00GB, used=141.72MB
    Metadata: total=8.00MB, used=0.00
    You are running with your metadata in DUP mode (duplicated metadata on a single device). Btrfs has allocated 1GB for metadata so far and has used 141.72MB of it. Note that these are the single totals. You would then double this for the actual on-disk consumption. It has also allocated 8MB of unduplicated metadata, but has not used any.
    What does the following tell us. I guess 2.67GB + 142 MB = 2.81 GB?
    You can't really add them up. It tells you it's uses 141MB of metadata, but it's actually consumed 280MB on disk, because it duplicates all metadata.
    [root@vm004 ~]# btrfs fi show
    Label: 'root' uuid: e88be872-eb9b-482f-bac2-7bde7235d946
         Total devices 1 FS bytes used 2.81GB
         devid 1 size 15.84GB used 6.04GB path /dev/sda3
    Because it's allocated 6GB. 4GB in unduplicated data and 2GB of duplicated metadata.
    [root@vm004 ~]# df -h
    df will only show you how much it thinks is consumed on the disk, but it very rarely is accurate with btrfs.

    Edited by: Avi Miller on Oct 30, 2012 7:09 AM
  • 2. Re: Understanding btrfs filesystem output
    Dude! Guru
    Currently Being Moderated
    Thanks for the reply. I was further testing how much data I can create with the dd command until the disk runs full. It stopped after 11.7 GB. Looking at the previous output, I wonder how to calculate that number. Considering how COW works, I think it is not possible to actually predict when a disk runs full - and perhaps that's why available disk space is not shown with the btrfs utility.
  • 3. Re: Understanding btrfs filesystem output
    Avi Miller Guru
    Currently Being Moderated
    Dude wrote:
    Thanks for the reply. I was further testing how much data I can create with the dd command until the disk runs full. It stopped after 11.7 GB. Looking at the previous output, I wonder how to calculate that number. Considering how COW works, I think it is not possible to actually predict when a disk runs full - and perhaps that's why available disk space is not shown with the btrfs utility.
    Correct. It is (almost) impossible to predict how much actual data you'll be able to store on a btrfs volume, as it allocates chucks of data and metadata and then consumes them as necessary. And, as more activity occurs on the filesystem, e.g. snapshots or sub volumes or COW, more metadata is required, thus requiring more allocations.

    Work is being done in the mainline btrfs-progs to make the output of btfs fi df way more verbose. I urge you to use the btrfs-devel mailing list for deep technical questions instead of these forums as there are a lot more knowledgable people on that list. Also, you'll be able to see what's coming. :)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points