Submit your Linux news story here.

How to use BTRFS to create compressed directories on Linux

Btrfs (B-tree file system) designed by Oracle for use in Linux. It uses the concept of the copy-on-write (COW). It provides self-healing, online defragmentation, and much more. This tutorial shows how to compress directories using BTRFS with loopback devices on Linux operating system.

From the article

I had a situation with very large, compressible files. These files are huge, but mostly reapeated data — they are test vectors for a piece of hardware. As the traces have grown towards 1TB, reading and writing has got painfully slow. What I need was lightweight transparent compression that works on one directory.

Here is one answer that seems to work: use the ‘loopback’ device to create a small BTRFS filesystem. BTRFS lzo optimization works very well. The data fits in a fraction of the storage, and reading and writing are much faster.