Optimizing storage space size
In the previous section, we reviewed some of the features of the Btrfs filesystem. Now it is time to learn how to optimize this used storage space in more detail.
Btrfs reserves some raw storage at its lowest level because the volume needs to contain file data or volume metadata. For that, it allocates pieces of raw storage for use by the filesystem. A piece of storage gets referred to as a chunk. Its main function is to contain file data or volume metadata to replicate on the same volume or another similar device.
Storage space gets allocated to the chunks, and the space is used by the blocks. A chunk with no blocks used is unallocated; a chunk with one or more blocks used is allocated. All chunks can get allocated even if not all the space is used.
Btrfs uses delayed allocation to enable better disk allocation. Btrfs only allocates disk space when the system needs to get rid of dirty pages, so in the end, you get much larger allocations and...