https://btrfs.wiki.kernel.org/index.php/FAQ
https://wiki.archlinux.org/title/Btrfs
The best solution for small devices (under about 16 GB) is to reformat the FS with the
--mixed
option to mkfs.btrfs. This needs a kernel 2.6.37 or later, and similarly recent btrfs-progs.
$ mkfs.btrfs --mixed -f blk/btrfs
btrfs-progs v5.4.1
See <http://btrfs.wiki.kernel.org> for more information.
Label: (null)
UUID: b648a523-f4cf-450a-b7a7-d4f020dfc3f0
Node size: 4096
Sector size: 4096
Filesystem size: 8.00GiB
Block group profiles:
Data+Metadata: single 8.00MiB
System: single 4.00MiB
SSD detected: no
Incompat features: mixed-bg, extref, skinny-metadata
Checksum: crc32c
Number of devices: 1
Devices:
ID SIZE PATH
1 8.00GiB blk/btrfs
-o compress=zstd
Test with about 190,0000 empty files (containing symlink):
tar xaf ~/attrs-test.tar.zst
Reiserfs needs 325M to store those data, tmpfs uses 5.6G to store all the metadata.
Default btrfs:
$ sudo btrfs fi df /mnt/sdb/rsync-huai/mountpoint/btrfs/
Data, single: total=8.00MiB, used=320.00KiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=1.25GiB, used=976.80MiB
GlobalReserve, single: total=3.97MiB, used=0.00B
Mixed + zstd:
$ sudo btrfs fi df /mnt/sdb/rsync-huai/mountpoint/btrfs/
System, single: total=4.00MiB, used=4.00KiB
Data+Metadata, single: total=1.63GiB, used=1022.67MiB
GlobalReserve, single: total=15.36MiB, used=0.00B