Compression with btrfs-send / btrfs-receive

btrfscompression

When I send a compressed subvol (i.e., one part of a filesystem mounted with the compress mount option) with btrfs-send, does btrfs-send send it compressed, or does it decompress it first?

Similarly, when I receive the subvol with btrfs-receive, does btrfs-receive re-compress?

Best Answer

btrfs-send will perform read syscalls, which means it will decompress the data indeed. Then data are streamed uncompressed, and btrfs-receive will perform write syscalls, which will compress depending on the target btrfs system compress mount option.

So for instance, you could have an existing btrfs system with all kinds of compression used for different files, and write to a new one where all data will be zstd-compressed.

Related Question