See the Arch Linux wiki

Creating the file system on a single device

sudo mkfs.btrfs -L <mylabel> /dev/<partition>

Increasing the node size decreases fragmentation but it increases operation times.

sudo mkfs.btrfs -L <mylabel> -n 32k /dev/<partition>

Enabling compression

See here

For all files going forward

btrfs property set <fs-root> compression <alg>

<alg> can be

  • zlib
  • lzo
  • zstd
  • no (for no compression)

For existing files

See here.

Encrypting Btrfs

Btrfs doesn’t support encryption itself, but it can be placed on a hard drive with encryption. See the Arch Linux wiki and Hard Drive Encryption for more details.