Why is BTRFS so grossly misquoting the size of small files on my filesystem?
[pi@rpi scipy]% cat __init__.py | wc -c # literal byte count
4729
[pi@rpi scipy]% du --apparent-size -h __init__.py # size on filesystem (same)
4.7K __init__.py
[pi@rpi scipy]% du -h __init__.py # reported size to ls
1.0M __init__.py
- Completely stock options (
defaults
, plainmkfs.btrfs
) - Linux Kernel 3.18
- RAID1
Okay, so it appaears that BTRFS is rounding files up to 1MB at some threshold. That 1MB is exactly 1048576 (or 2²⁰) bytes.
More surprisingly, cat __init__.py > __init__2.py
makes a new file of the correct size. Does this have something to do with the fact that I created these files over samba?
Newly created files also have the correct size.