Skip to content

BTRFS: Default Mount Options are Suboptimal #59

@the-burrito-triangle

Description

@the-burrito-triangle

Currently, CachyOS uses unnecessary/suboptimal BTRFS mount options space_cache=v2 and compress=zstd in /etc/fstab.

  1. Mount option space_cache=v2is not needed for a clean install and has been a default mkfs.btrfs option (free-space-tree) since btrfs-progs 5.15 and supported since kernel 4.5. It is redundant and unnecessary to add this mount option.

  2. Mount option compress=zstd defaults to compression level 3, for NVMe drives, this greatly slows down throughput (zstd compression on CPU is slower than NVMe write speed). Compression level 1 (compress=zstd:1) has been the default on Fedora for some time now and is the better choice for modern storage media that uses PCIe vs. legacy interfaces like SATA. (Even for SATA, level 3 is questionable for SSDs with weak CPU compression performance, but nowhere near as bad when used with an NVMe drive.) Compression, can, however, improve write performance on slow interfaces (e.g. SATA with a HDD, USB 2.0 and possibly USB 3.0 storage devices) when using higher compression levels (e.g., >= 3). To achieve the best performance, the CPU's compression rate (for a given level) must be faster than the interface's write bandwidth. Otherwise compression stymies write performance as the CPU becomes the bottleneck and can actually slow the whole system down and kill battery life.

Space Cache V2 Notes:

https://btrfs.readthedocs.io/en/latest/mkfs.btrfs.html

(default since btrfs-progs 5.15, kernel support since 4.5)
Online conversion can be done by mounting with space_cache=v2, this is sufficient to be done one time.

https://wiki.tnonline.net/w/Btrfs/Space_Cache

With btrfs-progs 5.15 and newer, the Free Space Tree is default. There is no need to specify any special options to take advantage of the new cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions