BTRFS with compression enabled uses a heuristic not to compress files that are not well compressible. Does compressing existing files with "btrfs filesystem defrag -c" also use the heuristic, or does it compress all files even if they are not well compressible?
btrfs filesystem defrag -c
seems to force compression, eventually flagging a file as non-compressible only if initial compression attempts were not fruitful and the filesystem was not mounted withcompress-force
.To prove that, I created a file having a first 1M incompressible data, followed by 128K of compressible data (ie: a text file). The file was stored in
/tmp
and copied to a btrfs mount point with various options: