LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Btrfs - how much free space do I have? (https://www.linuxquestions.org/questions/linux-general-1/btrfs-how-much-free-space-do-i-have-4175659112/)

lucmove 08-13-2019 11:29 PM

Btrfs - how much free space do I have?
 
I've been reading a lot about Btrfs and I know that calculating free space in it "is complicated," but note that this is a very new file system where no snapshots have ever been made. The problem is that 'df -h' and 'btrfs filesystem usage' give me different numbers:

Code:

# df -h
Filesystem      Size  Used  Avail Use% Mounted on
/dev/sda2        909G  871G  37G  96%  /dev/home/btuser

# btrfs filesystem usage /dev/sda2

Overall:
    Device size:                908.32GiB
    Device allocated:                874.02GiB
    Device unallocated:                  34.30GiB
    Device missing:                    0.00B
    Used:                        863.77GiB
    Free (estimated):                  43.18GiB        (min: 43.18GiB)
    Data ratio:                              1.00
    Metadata ratio:                      1.00
    Global reserve:                512.00MiB        (used: 0.00B)

Data,single: Size:871.01GiB, Used:862.13GiB
  /dev/sda2          871.01GiB

Metadata,single: Size:3.01GiB, Used:1.64GiB
  /dev/sda2          3.01GiB

System,single: Size:4.00MiB, Used:112.00KiB
  /dev/sda2          4.00MiB

Unallocated:
  /dev/sda2          34.30GiB

So how much free space do I really have? Is it 43GB or 34GB?

permaroot 08-14-2019 04:29 PM

Quote:

Originally Posted by lucmove (Post 6024934)
I've been reading a lot about Btrfs and I know that calculating free space in it "is complicated," but note that this is a very new file system where no snapshots have ever been made. The problem is that 'df -h' and 'btrfs filesystem usage' give me different numbers:

Code:

# df -h
Filesystem      Size  Used  Avail Use% Mounted on
/dev/sda2        909G  871G  37G  96%  /dev/home/btuser

# btrfs filesystem usage /dev/sda2

Overall:
    Device size:                908.32GiB
    Device allocated:                874.02GiB
    Device unallocated:                  34.30GiB
    Device missing:                    0.00B
    Used:                        863.77GiB
    Free (estimated):                  43.18GiB        (min: 43.18GiB)
    Data ratio:                              1.00
    Metadata ratio:                      1.00
    Global reserve:                512.00MiB        (used: 0.00B)

Data,single: Size:871.01GiB, Used:862.13GiB
  /dev/sda2          871.01GiB

Metadata,single: Size:3.01GiB, Used:1.64GiB
  /dev/sda2          3.01GiB

System,single: Size:4.00MiB, Used:112.00KiB
  /dev/sda2          4.00MiB

Unallocated:
  /dev/sda2          34.30GiB

So how much free space do I really have? Is it 43GB or 34GB?

you have 10.25GB free.

device size minus allocated = 34.30 - If I understand this is space not allocated for use.

allocated minus used = 10.25G, which if added to the unallocated equals the "estimated" free space

lucmove 08-14-2019 05:19 PM

Quote:

Originally Posted by permaroot (Post 6025198)
you have 10.25GB free.
device size minus allocated = 34.30 - If I understand this is space not allocated for use.
allocated minus used = 10.25G, which if added to the unallocated equals the "estimated" free space

Sorry, I don't understand at all.

Where does that 10.25GB come from? There is no mention of 10.25GB whatsoever and I can't see how it could come out of any calculation.

I am confused about Btrfs, but I trust 'df.' Yes, I know, df can't really handle Btrfs, but...

Code:

# df -h
Filesystem      Size  Used  Avail Use% Mounted on
/dev/sda2        909G  871G  37G  96%  /dev/home/btuser

...and I know those numbers are correct. The partition really is supposed to be 909GB in size and the amount of data is knwon to be around 871GB. I have a copy in EXT4 (874GB) and XFS (869GB). And 909 minus 871 is 38, so the available free space is about right too.

You see, I get 34GB free in EXT4 and 40GB in XFS. Same exact data. Btrfs says I have either 43GB or 34GB of free space — because I can't read the information correctly. Between 43GB and 34GB, I couldn't decide whether Btrfs is so space efficient that it will give me as much as 43GB of free space or rather it will give me as little as 34GB because its journaling is so heavy.

And you tell me I only have 10.25GB! Why? :confused:

permaroot 08-14-2019 05:32 PM

What is your lsblk and lsblk -f and fdisk -l output?


All times are GMT -5. The time now is 12:21 AM.