I would like to know when btrfs allocates space?

the background of this question is that using the two commands

  1. btrfs filesystem show and
  2. btrfs filesystem df /

which provides this output on my system:

$> btrfs filesystem show
 Label: none  uuid: xxxxxxxxx-xxxx-xxx-xxx-xxxxxxxxxxxx
     Total devices 1 FS bytes used 25.77GiB
     devid    1 size 40.00GiB used 26.53GiB path /dev/sda1

$> btrfs filesystem df /
 Data, single: total=25.00GiB, used=24.48GiB
 System, single: total=32.00MiB, used=16.00KiB
 Metadata, single: total=1.50GiB, used=1.29GiB
 GlobalReserve, single: total=82.64MiB, used=0.00B

it seems that while the second command btrfs filesystem df / indicates that most everything of the Data, single is used, the first command btrfs filesystem show seems to tell me that there is still some roughly 13GiB space left.

Therefore the question: When does btrfs allocate the space? Do I have to care, or does this happen automaticly (for all entries like Metadata, single, System,single)?

Additionally should the values of both commands correspond / "add up?"?

  • I think you should take these detailed technical questions to the BTRFS mailing list. You'd have a better shot at getting answers there; assuming you've already done your homework. Their Wiki also has links to papers which describe the internals of the filesystem. I believe one of them discusses allocation. – Emmanuel Rosa May 26 '17 at 18:58
  • just a sidenote, btrfs fi usage <path> shows allocation and usage combined. – funky-future Jun 9 '17 at 10:36

Your Answer

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

Browse other questions tagged or ask your own question.