3

On my 256 GB disc:

# btrfs fi show /dev/sdd3
Total devices 1 FS bytes used 143.43GiB
devid    1 size 234.22GiB used 234.22GiB path /dev/sdd3
Btrfs v3.12

I don't understand the discrepancy between "143.43GiB" and "used 234.22GiB". I thought, perhaps I have duplication of the data on, but the way I read this:

# btrfs filesystem df /
Data, single: total=230.20GiB, used=142.32GiB
System, DUP: total=8.00MiB, used=32.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, DUP: total=2.00GiB, used=1.19GiB
Metadata, single: total=8.00MiB, used=0.00

my data is stored only once, "single", and I don't understand where the remaining, roughtly 100 GiB, is used. Quote from the the btrfs wiki:

single - data usage matches the raw block group usage on a single device (data = raw; 1GB of data requires 1GB of disk

Mount info:

# mount | grep sdd3
/dev/sdd3 on / type btrfs (rw,noatime,ssd,noacl,space_cache)
3

Btrfs allocates data & metadata in fixed-sized chunks (1 GB for data, less for metadata). Even then btrfs doesn't necessarily fill the all of the chunks it has allocated. So even though you only have 143 GB of data btrfs has spread it across about 234 chunks, which is why it also says that you have 234 GB used. The "total" number that appears in df is the amount of space used by the chunks and the "used" number is the amount of space used by your data. However since by default btrfs keeps data and metadata in separate chunks you may run into an issue where you get erroneous out of space errors b/c you need to allocate more space for either data or metadata and all of the free space has already been allocated into chunks. Seeing as you still have .81 GB of metadata free you probably won't run into this issue, but if you do all you have to do is run something like:

btrfs b star -dusage=5

And if it says:

Done, had to relocate 0 out of n chunks

Then just keep running it with a higher number than five until it says that it had to relocate more than zero chunks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.