7

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?

0

2 Answers 2

6

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.

3

--compressed-data send data that is compressed on the filesystem directly without decompressing it

If the receiver supports the BTRFS_IOC_ENCODED_WRITE ioctl (added in Linux 6.0), it can also write it directly without decompressing it. Otherwise, the receiver will fall back to decompressing it and writing it normally.

This requires protocol version 2 or higher. If --proto was not used, then --compressed-data implies --proto 2.

https://btrfs.readthedocs.io/en/latest/btrfs-send.html

1
  • Nice to know they added that since.
    – Archange
    Commented Jan 27, 2024 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .