Administration 管理 

The main administration tool for BTRFS filesystems is btrfs(8). Please refer to the manual pages of the subcommands for further documentation.
BTRFS 文件系统的主要管理工具是 btrfs(8)。请参考子命令的手册页以获取更多文档。

Mount options 挂载选项

BTRFS SPECIFIC MOUNT OPTIONS
BTRFS 特定挂载选项

This section describes mount options specific to BTRFS. For the generic mount options please refer to mount(8) manual page. The options are sorted alphabetically (discarding the no prefix).
本节描述了特定于 BTRFS 的挂载选项。有关通用挂载选项,请参阅 mount(8)手册页。这些选项按字母顺序排序(丢弃前缀 no)。

Note 注意

Most mount options apply to the whole filesystem and only options in the first mounted subvolume will take effect. This is due to lack of implementation and may change in the future. This means that (for example) you can’t set per-subvolume nodatacow, nodatasum, or compress using mount options. This should eventually be fixed, but it has proved to be difficult to implement correctly within the Linux VFS framework.
大多数挂载选项适用于整个文件系统,只有在第一个挂载的子卷中的选项才会生效。这是由于实现的缺失,可能会在将来发生变化。这意味着(例如),您无法使用挂载选项设置每个子卷的 nodatacow、nodatasum 或压缩。这应该最终会得到解决,但在 Linux VFS 框架内正确实现已被证明是困难的。

Mount options are processed in order, only the last occurrence of an option takes effect and may disable other options due to constraints (see e.g. nodatacow and compress). The output of mount command shows which options have been applied.
挂载选项按顺序处理,只有选项的最后一次出现才会生效,并且可能由于约束(请参见 nodatacow 和 compress)而禁用其他选项。挂载命令的输出显示了已应用的选项。

acl, noacl

(default: on) (默认值:开启)

Enable/disable support for POSIX Access Control Lists (ACLs). See the acl(5) manual page for more information about ACLs.
启用/禁用对 POSIX 访问控制列表(ACL)的支持。有关 ACL 的更多信息,请参阅 acl(5)手册页。

The support for ACL is build-time configurable (BTRFS_FS_POSIX_ACL) and mount fails if acl is requested but the feature is not compiled in.
ACL 支持是构建时可配置的(BTRFS_FS_POSIX_ACL),如果请求 acl 但未编译该功能,则挂载失败。

autodefrag, noautodefrag autodefrag,noautodefrag

(since: 3.0, default: off)
(自 3.0 起,默认关闭)

Enable automatic file defragmentation. When enabled, small random writes into files (in a range of tens of kilobytes, currently it’s 64KiB) are detected and queued up for the defragmentation process. May not be well suited for large database workloads.
启用自动文件碎片整理。启用后,文件中的小随机写入(在几十千字节的范围内,当前为 64KiB)将被检测并排队进行碎片整理过程。可能不适用于大型数据库工作负载。

The read latency may increase due to reading the adjacent blocks that make up the range for defragmentation, successive write will merge the blocks in the new location.
由于读取用于碎片整理的范围的相邻块,读取延迟可能会增加,连续写入将合并新位置中的块。

Warning 警告

Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14-rc2 as well as with Linux stable kernel versions ≥ 3.10.31, ≥ 3.12.12 or ≥ 3.13.4 will break up the reflinks of COW data (for example files copied with cp --reflink, snapshots or de-duplicated data). This may cause considerable increase of space usage depending on the broken up reflinks.
在 Linux 内核版本 < 3.9 或 ≥ 3.14-rc2 以及 Linux 稳定内核版本 ≥ 3.10.31、≥ 3.12.12 或 ≥ 3.13.4 上进行碎片整理会破坏 COW 数据的重定向链接(例如使用 cp --reflink 复制的文件、快照或去重数据)。这可能会导致空间使用量大幅增加,具体取决于被破坏的重定向链接。

barrier, nobarrier 障碍,无障碍

(default: on) (默认值:开启)

Ensure that all IO write operations make it through the device cache and are stored permanently when the filesystem is at its consistency checkpoint. This typically means that a flush command is sent to the device that will synchronize all pending data and ordinary metadata blocks, then writes the superblock and issues another flush.
确保所有 IO 写入操作在文件系统处于一致性检查点时通过设备缓存并永久存储。这通常意味着向设备发送刷新命令,该命令将同步所有待处理数据和普通元数据块,然后写入超级块并发出另一个刷新命令。

The write flushes incur a slight hit and also prevent the IO block scheduler to reorder requests in a more effective way. Disabling barriers gets rid of that penalty but will most certainly lead to a corrupted filesystem in case of a crash or power loss. The ordinary metadata blocks could be yet unwritten at the time the new superblock is stored permanently, expecting that the block pointers to metadata were stored permanently before.
写入刷新会造成轻微的影响,并阻止 IO 块调度程序以更有效的方式重新排序请求。禁用屏障会消除这种惩罚,但几乎肯定会导致在崩溃或断电的情况下文件系统损坏。普通的元数据块可能在新的超级块永久存储时尚未写入,期望在此之前元数据的块指针已经永久存储。

On a device with a volatile battery-backed write-back cache, the nobarrier option will not lead to filesystem corruption as the pending blocks are supposed to make it to the permanent storage.
在具有易失性电池支持的写回缓存设备上,nobarrier 选项不会导致文件系统损坏,因为待处理的块应该能够到达永久存储。

check_int, check_int_data, check_int_print_mask=<value>
check_int,check_int_data,check_int_print_mask=<value>

(since: 3.0, default: off)
(自 3.0 起,默认关闭)

These debugging options control the behavior of the integrity checking module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is to verify that all blocks from a given transaction period are properly linked.
这些调试选项控制完整性检查模块的行为(需要 BTRFS_FS_CHECK_INTEGRITY 配置选项)。主要目标是验证给定事务周期内的所有块是否正确链接。

check_int enables the integrity checker module, which examines all block write requests to ensure on-disk consistency, at a large memory and CPU cost.
check_int 启用完整性检查器模块,检查所有块写入请求,以确保磁盘上的一致性,但会消耗大量内存和 CPU。

check_int_data includes extent data in the integrity checks, and implies the check_int option.
check_int_data 在完整性检查中包含范围数据,并暗示了 check_int 选项。

check_int_print_mask takes a bitmask of BTRFSIC_PRINT_MASK_* values as defined in fs/btrfs/check-integrity.c, to control the integrity checker module behavior.
check_int_print_mask 接受在 fs/btrfs/check-integrity.c 中定义的 BTRFSIC_PRINT_MASK_*值的位掩码,以控制完整性检查器模块的行为。

See comments at the top of fs/btrfs/check-integrity.c for more information.
更多信息请参阅 fs/btrfs/check-integrity.c 顶部的注释。

clear_cache 清除缓存

Force clearing and rebuilding of the free space cache if something has gone wrong.
如果出现问题,强制清除并重建空闲空间缓存。

For free space cache v1, this only clears (and, unless nospace_cache is used, rebuilds) the free space cache for block groups that are modified while the filesystem is mounted with that option. To actually clear an entire free space cache v1, see btrfs check --clear-space-cache v1.
对于空闲空间缓存 v1,这只清除(并且,除非使用 nospace_cache,否则重建)在挂载文件系统时使用该选项修改的块组的空闲空间缓存。要实际清除整个空闲空间缓存 v1,请参阅 btrfs check --clear-space-cache v1。

For free space cache v2, this clears the entire free space cache. To do so without requiring to mounting the filesystem, see btrfs check --clear-space-cache v2.
对于空闲空间缓存 v2,这将清除整个空闲空间缓存。要在无需挂载文件系统的情况下执行此操作,请参阅 btrfs check --clear-space-cache v2。

See also: space_cache. 另请参阅:space_cache。

commit=<seconds> commit=<秒数>

(since: 3.12, default: 30)
(自 3.12 起,默认值:30)

Set the interval of periodic transaction commit when data are synchronized to permanent storage. Higher interval values lead to larger amount of unwritten data, which has obvious consequences when the system crashes. The upper bound is not forced, but a warning is printed if it’s more than 300 seconds (5 minutes). Use with care.
在将数据同步到永久存储时设置周期性事务提交的间隔。较高的间隔值会导致更多未写入的数据,当系统崩溃时会产生明显的后果。上限没有强制要求,但如果超过 300 秒(5 分钟),则会打印警告。请谨慎使用。

compress, compress=<type[:level]>, compress-force, compress-force=<type[:level]>
压缩,压缩=<类型[:级别]>,压缩强制,压缩强制=<类型[:级别]>

(default: off, level support since: 5.1)
(默认值:关闭,级别支持自:5.1)

Control BTRFS file data compression. Type may be specified as zlib, lzo, zstd or no (for no compression, used for remounting). If no type is specified, zlib is used. If compress-force is specified, then compression will always be attempted, but the data may end up uncompressed if the compression would make them larger.
控制 BTRFS 文件数据压缩。类型可以指定为 zlib、lzo、zstd 或 no(用于重新挂载的无压缩)。如果未指定类型,则使用 zlib。如果指定了 compress-force,则始终会尝试压缩,但如果压缩会使数据变大,则数据可能最终未压缩。

Both zlib and zstd (since version 5.1) expose the compression level as a tunable knob with higher levels trading speed and memory (zstd) for higher compression ratios. This can be set by appending a colon and the desired level. ZLIB accepts the range [1, 9] and ZSTD accepts [1, 15]. If no level is set, both currently use a default level of 3. The value 0 is an alias for the default level.
自版本 5.1 起,zlib 和 zstd 都将压缩级别公开为可调节旋钮,较高级别的速度和内存(zstd)可换取更高的压缩比。可以通过附加冒号和所需级别来设置。ZLIB 接受范围[1, 9],ZSTD 接受[1, 15]。如果未设置级别,则当前都使用默认级别 3。值 0 是默认级别的别名。

Otherwise some simple heuristics are applied to detect an incompressible file. If the first blocks written to a file are not compressible, the whole file is permanently marked to skip compression. As this is too simple, the compress-force is a workaround that will compress most of the files at the cost of some wasted CPU cycles on failed attempts. Since kernel 4.15, a set of heuristic algorithms have been improved by using frequency sampling, repeated pattern detection and Shannon entropy calculation to avoid that.
否则,将应用一些简单的启发式方法来检测无法压缩的文件。如果写入文件的前几个块是不可压缩的,则整个文件将被永久标记为跳过压缩。由于这太简单了,压缩强制是一个解决方法,它将以一些浪费的 CPU 周期为代价,压缩大多数文件。自内核 4.15 开始,一组启发式算法已通过使用频率采样、重复模式检测和香农熵计算进行改进,以避免这种情况。

Note 注意

If compression is enabled, nodatacow and nodatasum are disabled.
如果启用了压缩,则禁用 nodatacow 和 nodatasum。

datacow, nodatacow 数据牛,无数据牛

(default: on) (默认值:开启)

Enable data copy-on-write for newly created files. Nodatacow implies nodatasum, and disables compression. All files created under nodatacow are also set the NOCOW file attribute (see chattr(1)).
为新创建的文件启用数据写时复制。Nodatacow 意味着 nodatasum,并禁用压缩。在 nodatacow 下创建的所有文件也将设置为 NOCOW 文件属性(参见 chattr(1))。

Note 注意

If nodatacow or nodatasum are enabled, compression is disabled.
如果启用了 nodatacow 或 nodatasum,则禁用压缩。

Updates in-place improve performance for workloads that do frequent overwrites, at the cost of potential partial writes, in case the write is interrupted (system crash, device failure).
就地更新可提高频繁覆盖的工作负载的性能,但可能会导致部分写入,如果写入被中断(系统崩溃,设备故障)。

datasum, nodatasum datasum,nodatasum

(default: on) (默认值:开启)

Enable data checksumming for newly created files. Datasum implies datacow, i.e. the normal mode of operation. All files created under nodatasum inherit the “no checksums” property, however there’s no corresponding file attribute (see chattr(1)).
为新创建的文件启用数据校验。数据校验意味着数据拷贝,即正常的操作模式。在 nodatasum 下创建的所有文件都继承“无校验”属性,但没有相应的文件属性(参见 chattr(1))。

Note 注意

If nodatacow or nodatasum are enabled, compression is disabled.
如果启用了 nodatacow 或 nodatasum,则禁用压缩。

There is a slight performance gain when checksums are turned off, the corresponding metadata blocks holding the checksums do not need to updated. The cost of checksumming of the blocks in memory is much lower than the IO, modern CPUs feature hardware support of the checksumming algorithm.
当关闭校验和时,性能会略有提升,持有校验和的相应元数据块无需更新。内存中块的校验成本远低于 IO,现代 CPU 具有校验算法的硬件支持。

degraded 降级

(default: off) (默认: 关闭)

Allow mounts with fewer devices than the RAID profile constraints require. A read-write mount (or remount) may fail when there are too many devices missing, for example if a stripe member is completely missing from RAID0.
允许挂载比 RAID 配置文件要求的设备少的挂载点。当缺少太多设备时,例如 RAID0 中完全缺少条带成员时,读写挂载(或重新挂载)可能会失败。

Since 4.14, the constraint checks have been improved and are verified on the chunk level, not at the device level. This allows degraded mounts of filesystems with mixed RAID profiles for data and metadata, even if the device number constraints would not be satisfied for some of the profiles.
自 4.14 版本以来,约束检查已得到改进,并在块级别而不是设备级别上进行验证。这允许对具有混合数据和元数据 RAID 配置文件的文件系统进行降级挂载,即使某些配置文件的设备数量约束未满足。

Example: metadata -- raid1, data -- single, devices -- /dev/sda, /dev/sdb
示例:元数据 -- raid1,数据 -- 单个,设备 -- /dev/sda/dev/sdb

Suppose the data are completely stored on sda, then missing sdb will not prevent the mount, even if 1 missing device would normally prevent (any) single profile to mount. In case some of the data chunks are stored on sdb, then the constraint of single/data is not satisfied and the filesystem cannot be mounted.
假设数据完全存储在 sda 上,那么缺少 sdb 不会阻止挂载,即使通常情况下缺少一个设备会阻止(任何)单个配置文件挂载。如果一些数据块存储在 sdb 上,则单个/数据的约束条件不满足,文件系统无法挂载。

device=<devicepath> device=<设备路径>

Specify a path to a device that will be scanned for BTRFS filesystem during mount. This is usually done automatically by a device manager (like udev) or using the btrfs device scan command (e.g. run from the initial ramdisk). In cases where this is not possible the device mount option can help.
指定在挂载期间将用于扫描 BTRFS 文件系统的设备路径。这通常由设备管理器(如 udev)自动完成,或者使用 btrfs 设备扫描命令(例如,从初始 ramdisk 运行)。在无法自动完成此操作的情况下,设备挂载选项可以提供帮助。

Note 注意

Booting e.g. a RAID1 system may fail even if all filesystem’s device paths are provided as the actual device nodes may not be discovered by the system at that point.
即使提供了所有文件系统设备路径,例如 RAID1 系统的启动也可能失败,因为系统在那时可能尚未发现实际设备节点。

discard, discard=sync, discard=async, nodiscard
丢弃,丢弃=同步,丢弃=异步,不丢弃

(default: async when devices support it since 6.2, async support since: 5.6)
(默认值:自 6.2 版起支持异步,自 5.6 版起支持异步)

Enable discarding of freed file blocks. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must support discard for it to work.
启用释放文件块的丢弃。这对于 SSD 设备、薄置备 LUN 或虚拟机映像非常有用;但是,为了使其正常工作,每个存储层都必须支持丢弃。

In the synchronous mode (sync or without option value), lack of asynchronous queued TRIM on the backing device TRIM can severely degrade performance, because a synchronous TRIM operation will be attempted instead. Queued TRIM requires newer than SATA revision 3.1 chipsets and devices.
在同步模式(sync 或无选项值)中,由于后备设备 TRIM 上缺少异步排队的 TRIM,性能可能严重下降,因为将尝试同步 TRIM 操作。排队的 TRIM 需要更新于 SATA 修订版 3.1 的芯片组和设备。

The asynchronous mode (async) gathers extents in larger chunks before sending them to the devices for TRIM. The overhead and performance impact should be negligible compared to the previous mode and it’s supposed to be the preferred mode if needed.
异步模式(async)在将范围较大的范围聚集在一起后再将其发送到设备进行 TRIM。与前一模式相比,开销和性能影响应该可以忽略不计,如果需要的话,这应该是首选模式。

If it is not necessary to immediately discard freed blocks, then the fstrim tool can be used to discard all free blocks in a batch. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks.
如果不需要立即丢弃已释放的块,则可以使用 fstrim 工具批量丢弃所有空闲块。在系统活动较低的时期安排 TRIM 将防止对其他操作性能的潜在干扰。此外,如果范围太小,设备可能会忽略 TRIM 命令,因此运行批量丢弃实际上更有可能丢弃这些块。

enospc_debug, noenospc_debug

(default: off) (默认: 关闭)

Enable verbose output for some ENOSPC conditions. It’s safe to use but can be noisy if the system reaches near-full state.
为某些 ENOSPC 条件启用详细输出。使用起来是安全的,但如果系统接近完全状态,可能会产生噪音。

fatal_errors=<action>

(since: 3.4, default: bug)
(自 3.4 版本起,默认值:bug)

Action to take when encountering a fatal error.
遇到致命错误时要采取的操作。

bug 错误

BUG() on a fatal error, the system will stay in the crashed state and may be still partially usable, but reboot is required for full operation
在发生致命错误时调用 BUG(),系统将保持崩溃状态,可能仍然部分可用,但需要重新启动才能完全运行。

panic 恐慌

panic() on a fatal error, depending on other system configuration, this may be followed by a reboot. Please refer to the documentation of kernel boot parameters, e.g. panic, oops or crashkernel.
在致命错误时调用 panic(),取决于其他系统配置,可能会随后重新启动。请参考内核引导参数的文档,例如 panic、oops 或 crashkernel。

flushoncommit, noflushoncommit
在提交时刷新,不在提交时刷新

(default: off) (默认: 关闭)

This option forces any data dirtied by a write in a prior transaction to commit as part of the current commit, effectively a full filesystem sync.
此选项强制将先前事务中由写操作脏化的任何数据作为当前提交的一部分提交,实际上是完整的文件系统同步。

This makes the committed state a fully consistent view of the file system from the application’s perspective (i.e. it includes all completed file system operations). This was previously the behavior only when a snapshot was created.
这使得提交的状态从应用程序的角度看是文件系统的完全一致视图(即包括所有已完成的文件系统操作)。以前只有在创建快照时才会出现这种行为。

When off, the filesystem is consistent but buffered writes may last more than one transaction commit.
当关闭时,文件系统是一致的,但缓冲写入可能会持续超过一个事务提交。

fragment=<type> 片段=<类型>

(depends on compile-time option CONFIG_BTRFS_DEBUG, since: 4.4, default: off)
(取决于编译时选项 CONFIG_BTRFS_DEBUG,自 4.4 版本起,默认为关闭)

A debugging helper to intentionally fragment given type of block groups. The type can be data, metadata or all. This mount option should not be used outside of debugging environments and is not recognized if the kernel config option CONFIG_BTRFS_DEBUG is not enabled.
一个调试助手,用于有意破坏给定类型的块组。类型可以是数据、元数据或全部。此挂载选项不应在调试环境之外使用,并且如果未启用内核配置选项 CONFIG_BTRFS_DEBUG,则不会被识别。

nologreplay 无日志重放

(default: off, even read-only)
(默认:关闭,即使是只读)

The tree-log contains pending updates to the filesystem until the full commit. The log is replayed on next mount, this can be disabled by this option. See also treelog. Note that nologreplay is the same as norecovery.
树日志包含对文件系统的挂起更新,直到完全提交。下次挂载时会重放日志,可以通过此选项禁用。另请参阅 treelog。请注意,nologreplay 与 norecovery 相同。

Warning 警告

Currently, the tree log is replayed even with a read-only mount! To disable that behaviour, mount also with nologreplay.
目前,即使是只读挂载,树日志也会被重放!要禁用该行为,请同时使用 nologreplay 挂载。

max_inline=<bytes> max_inline=<字节>

(default: min(2048, page size) )
(默认值:min(2048, 页大小))

Specify the maximum amount of space, that can be inlined in a metadata b-tree leaf. The value is specified in bytes, optionally with a K suffix (case insensitive). In practice, this value is limited by the filesystem block size (named sectorsize at mkfs time), and memory page size of the system. In case of sectorsize limit, there’s some space unavailable due to b-tree leaf headers. For example, a 4KiB sectorsize, maximum size of inline data is about 3900 bytes.
指定元数据 B 树叶中可以内联的最大空间量。该值以字节为单位指定,可选择带有 K 后缀(大小写不敏感)。在实践中,此值受文件系统块大小(在 mkfs 时称为扇区大小)和系统的内存页面大小的限制。在扇区大小限制的情况下,由于 B 树叶头部的一些空间不可用。例如,对于 4KiB 扇区大小,内联数据的最大大小约为 3900 字节。

Inlining can be completely turned off by specifying 0. This will increase data block slack if file sizes are much smaller than block size but will reduce metadata consumption in return.
通过指定 0,可以完全关闭内联。如果文件大小远小于块大小,则会增加数据块的空闲空间,但会减少元数据的消耗。

Note 注意

The default value has changed to 2048 in kernel 4.6.
默认值已在内核 4.6 中更改为 2048。

metadata_ratio=<value> 元数据比率=<value>

(default: 0, internal logic)
(默认值:0,内部逻辑)

Specifies that 1 metadata chunk should be allocated after every value data chunks. Default behaviour depends on internal logic, some percent of unused metadata space is attempted to be maintained but is not always possible if there’s not enough space left for chunk allocation. The option could be useful to override the internal logic in favor of the metadata allocation if the expected workload is supposed to be metadata intense (snapshots, reflinks, xattrs, inlined files).
指定每个值数据块后应分配 1 个元数据块。默认行为取决于内部逻辑,尝试保持一定比例的未使用元数据空间,但如果没有足够的空间来进行块分配,则不一定总是可能。如果预期的工作负载应该是元数据密集型的(快照、重定向链接、扩展属性、内联文件),该选项可能对覆盖内部逻辑以支持元数据分配很有用。

norecovery 无恢复

(since: 4.5, default: off)
(自 4.5 版本起,默认关闭)

Do not attempt any data recovery at mount time. This will disable logreplay and avoids other write operations. Note that this option is the same as nologreplay.
在挂载时不要尝试任何数据恢复。这将禁用日志重放并避免其他写操作。请注意,此选项与 nologreplay 相同。

Note 注意

The opposite option recovery used to have different meaning but was changed for consistency with other filesystems, where norecovery is used for skipping log replay. BTRFS does the same and in general will try to avoid any write operations.
逆向选项 recovery 曾经有不同的含义,但为了与其他文件系统保持一致,已更改为 norecovery 用于跳过日志重放。BTRFS 也是如此,通常会尝试避免任何写操作。

rescan_uuid_tree 重新扫描 UUID 树

(since: 3.12, default: off)
(自 3.12 版本起,默认关闭)

Force check and rebuild procedure of the UUID tree. This should not normally be needed.
强制检查和重建 UUID 树的过程。通常情况下不需要此操作。

rescue 救援

(since: 5.9) (自 5.9 版本起)

Modes allowing mount with damaged filesystem structures.
允许在损坏的文件系统结构下挂载的模式。

  • usebackuproot (since: 5.9, replaces standalone option usebackuproot)
    usebackuproot(自 5.9 起,替换独立选项 usebackuproot)

  • nologreplay (since: 5.9, replaces standalone option nologreplay)
    nologreplay(自 5.9 起,替换独立选项 nologreplay)

  • ignorebadroots, ibadroots (since: 5.11)
    忽略坏根, ibadroots (自版本 5.11 起)

  • ignoredatacsums, idatacsums (since: 5.11)
    ignoredatacsums,idatacsums(自 5.11 起)

  • all (since: 5.9) 所有(自:5.9 起)

skip_balance 跳过平衡

(since: 3.3, default: off)
(自:3.3 起,默认:关闭)

Skip automatic resume of an interrupted balance operation. The operation can later be resumed with btrfs balance resume, or the paused state can be removed with btrfs balance cancel. The default behaviour is to resume an interrupted balance immediately after a volume is mounted.
跳过中断平衡操作的自动恢复。稍后可以使用 btrfs balance resume 恢复操作,或者使用 btrfs balance cancel 移除暂停状态。默认行为是在挂载卷后立即恢复中断的平衡。

space_cache, space_cache=<version>, nospace_cache
空间缓存, space_cache=<version>, 不使用空间缓存

(nospace_cache since: 3.2, space_cache=v1 and space_cache=v2 since 4.5, default: space_cache=v2)
(nospace_cache 自 3.2 版本开始,space_cache=v1 和 space_cache=v2 自 4.5 版本开始,默认值:space_cache=v2)

Options to control the free space cache. The free space cache greatly improves performance when reading block group free space into memory. However, managing the space cache consumes some resources, including a small amount of disk space.
用于控制空闲空间缓存的选项。空闲空间缓存在将块组空闲空间读入内存时极大地提高了性能。然而,管理空间缓存会消耗一些资源,包括少量磁盘空间。

There are two implementations of the free space cache. The original one, referred to as v1, used to be a safe default but has been superseded by v2. The v1 space cache can be disabled at mount time with nospace_cache without clearing.
空闲空间缓存有两种实现方式。最初的实现方式被称为 v1,曾经是一个安全的默认选项,但已被 v2 取代。v1 空间缓存可以在挂载时通过 nospace_cache 禁用而不清除。

On very large filesystems (many terabytes) and certain workloads, the performance of the v1 space cache may degrade drastically. The v2 implementation, which adds a new b-tree called the free space tree, addresses this issue. Once enabled, the v2 space cache will always be used and cannot be disabled unless it is cleared. Use clear_cache,space_cache=v1 or clear_cache,nospace_cache to do so. If v2 is enabled, and v1 space cache will be cleared (at the first mount) and kernels without v2 support will only be able to mount the filesystem in read-only mode. On an unmounted filesystem the caches (both versions) can be cleared by “btrfs check --clear-space-cache”.
在非常大的文件系统(许多 TB)和某些工作负载上,v1 空间缓存的性能可能会急剧下降。添加了一个名为自由空间树的新 B 树的 v2 实现解决了这个问题。一旦启用,v2 空间缓存将始终被使用,并且除非清除,否则无法禁用。要这样做,请使用 clear_cache,space_cache=v1 或 clear_cache,nospace_cache。如果启用了 v2,并且 v1 空间缓存将被清除(在第一次挂载时),而没有 v2 支持的内核只能以只读模式挂载文件系统。在未挂载的文件系统上,可以通过“btrfs check --clear-space-cache”清除缓存(两个版本)。

The btrfs-check(8) and :doc:`mkfs.btrfs commands have full v2 free space cache support since v4.19.
自 v4.19 以来,btrfs-check(8)和:doc:`mkfs.btrfs`命令完全支持 v2 自由空间缓存。

If a version is not explicitly specified, the default implementation will be chosen, which is v2.
如果未明确指定版本,则将选择默认实现,即 v2。

ssd, ssd_spread, nossd, nossd_spread
固态硬盘,固态硬盘扩展,非固态硬盘,非固态硬盘扩展

(default: SSD autodetected)
(默认:SSD 自动检测)

Options to control SSD allocation schemes. By default, BTRFS will enable or disable SSD optimizations depending on status of a device with respect to rotational or non-rotational type. This is determined by the contents of /sys/block/DEV/queue/rotational). If it is 0, the ssd option is turned on. The option nossd will disable the autodetection.
用于控制 SSD 分配方案的选项。默认情况下,BTRFS 将根据设备相对于旋转或非旋转类型的状态来启用或禁用 SSD 优化。这是通过 /sys/block/DEV/queue/rotational 的内容来确定的。如果它为 0,则会打开 ssd 选项。选项 nossd 将禁用自动检测。

The optimizations make use of the absence of the seek penalty that’s inherent for the rotational devices. The blocks can be typically written faster and are not offloaded to separate threads.
优化利用了旋转设备固有的寻道惩罚的缺失。块通常可以更快地写入,并且不会被卸载到单独的线程。

Note 注意

Since 4.14, the block layout optimizations have been dropped. This used to help with first generations of SSD devices. Their FTL (flash translation layer) was not effective and the optimization was supposed to improve the wear by better aligning blocks. This is no longer true with modern SSD devices and the optimization had no real benefit. Furthermore it caused increased fragmentation. The layout tuning has been kept intact for the option ssd_spread.
自 4.14 版本开始,块布局优化已被取消。这曾经有助于第一代 SSD 设备。它们的 FTL(闪存转换层)效果不佳,优化旨在通过更好地对齐块来改善磨损。但对于现代 SSD 设备来说,这不再成立,这种优化没有真正的好处。此外,它导致了增加的碎片化。布局调整已保留在选项 ssd_spread 中。

The ssd_spread mount option attempts to allocate into bigger and aligned chunks of unused space, and may perform better on low-end SSDs. ssd_spread implies ssd, enabling all other SSD heuristics as well. The option nossd will disable all SSD options while nossd_spread only disables ssd_spread.
ssd_spread 挂载选项尝试分配更大且对齐的未使用空间块,并且在低端 SSD 上可能表现更好。ssd_spread 意味着 ssd,同时也启用所有其他 SSD 启发式。选项 nossd 将禁用所有 SSD 选项,而 nossd_spread 仅禁用 ssd_spread。

subvol=<path> subvol=<路径>

Mount subvolume from path rather than the toplevel subvolume. The path is always treated as relative to the toplevel subvolume. This mount option overrides the default subvolume set for the given filesystem.
从路径挂载子卷而不是顶级子卷。该路径始终被视为相对于顶级子卷。此挂载选项将覆盖为给定文件系统设置的默认子卷。

subvolid=<subvolid> 子卷 ID=<subvolid>

Mount subvolume specified by a subvolid number rather than the toplevel subvolume. You can use btrfs subvolume list of btrfs subvolume show to see subvolume ID numbers. This mount option overrides the default subvolume set for the given filesystem.
挂载由子卷 ID 号指定的子卷,而不是顶层子卷。您可以使用 btrfs 子卷列表或 btrfs 子卷显示来查看子卷 ID 号。此挂载选项将覆盖为给定文件系统设置的默认子卷。

Note 注意

If both subvolid and subvol are specified, they must point at the same subvolume, otherwise the mount will fail.
如果同时指定了 subvolid 和 subvol,则它们必须指向同一个子卷,否则挂载将失败。

thread_pool=<number> 线程池=<number>

(default: min(NRCPUS + 2, 8) )
(默认值:min(NRCPUS + 2, 8) )

The number of worker threads to start. NRCPUS is number of on-line CPUs detected at the time of mount. Small number leads to less parallelism in processing data and metadata, higher numbers could lead to a performance hit due to increased locking contention, process scheduling, cache-line bouncing or costly data transfers between local CPU memories.
要启动的工作线程数。NRCPUS 是在挂载时检测到的在线 CPU 数。较小的数字会导致在处理数据和元数据时并行性较低,较高的数字可能会导致性能下降,因为增加了锁竞争、进程调度、缓存行反弹或本地 CPU 内存之间昂贵的数据传输。

treelog, notreelog treelog,notreelog

(default: on) (默认值:开启)

Enable the tree logging used for fsync and O_SYNC writes. The tree log stores changes without the need of a full filesystem sync. The log operations are flushed at sync and transaction commit. If the system crashes between two such syncs, the pending tree log operations are replayed during mount.
启用用于 fsync 和 O_SYNC 写入的树日志记录。树日志存储更改,无需完全同步文件系统。日志操作在同步和事务提交时刷新。如果系统在两次这样的同步之间崩溃,挂载时会重放挂起的树日志操作。

Warning 警告

Currently, the tree log is replayed even with a read-only mount! To disable that behaviour, also mount with nologreplay.
目前,即使是只读挂载,树日志也会被重放!要禁用该行为,还要使用 nologreplay 进行挂载。

The tree log could contain new files/directories, these would not exist on a mounted filesystem if the log is not replayed.
如果日志不被重放,树木日志可能包含新文件/目录,在挂载的文件系统上不存在。

usebackuproot 使用备份根目录

(since: 4.6, default: off)
(自 4.6 起,默认关闭)

Enable autorecovery attempts if a bad tree root is found at mount time. Currently this scans a backup list of several previous tree roots and tries to use the first readable. This can be used with read-only mounts as well.
如果在挂载时间发现坏树根,则启用自动恢复尝试。目前,这会扫描几个先前树根的备份列表,并尝试使用第一个可读的树根。这也可以与只读挂载一起使用。

Note 注意

This option has replaced recovery.
此选项已替换恢复。

user_subvol_rm_allowed 用户子卷_rm_允许

(default: off) (默认: 关闭)

Allow subvolumes to be deleted by their respective owner. Otherwise, only the root user can do that.
允许子卷由其各自所有者删除。否则,只有 root 用户可以这样做。

Note 注意

Historically, any user could create a snapshot even if he was not owner of the source subvolume, the subvolume deletion has been restricted for that reason. The subvolume creation has been restricted but this mount option is still required. This is a usability issue. Since 4.18, the rmdir(2) syscall can delete an empty subvolume just like an ordinary directory. Whether this is possible can be detected at runtime, see rmdir_subvol feature in FILESYSTEM FEATURES.
从历史上看,即使用户不是源子卷的所有者,也可以创建快照,出于这个原因,子卷删除已被限制。子卷创建已被限制,但这个挂载选项仍然是必需的。这是一个可用性问题。自 4.18 版本以来,rmdir(2)系统调用可以像普通目录一样删除空子卷。是否可能在运行时检测到,参见 FILESYSTEM FEATURES 中的 rmdir_subvol 功能。

DEPRECATED MOUNT OPTIONS
已弃用的挂载选项

List of mount options that have been removed, kept for backward compatibility.
已删除的挂载选项列表,保留以确保向后兼容性。

recovery 恢复

(since: 3.2, default: off, deprecated since: 4.5)
(自 3.2 起,默认关闭,自 4.5 起弃用)

Note 注意

This option has been replaced by usebackuproot and should not be used but will work on 4.5+ kernels.
此选项已被 usebackuproot 替代,不应使用,但在 4.5+内核上可以工作。

inode_cache, noinode_cache
inode_cache,noinode_cache

(removed in: 5.11, since: 3.0, default: off)
(在 5.11 中移除,自 3.0 起,默认关闭)

Note 注意

The functionality has been removed in 5.11, any stale data created by previous use of the inode_cache option can be removed by btrfs rescue clear-ino-cache.
功能已在 5.11 中移除,之前使用 inode_cache 选项创建的任何陈旧数据都可以通过 btrfs rescue clear-ino-cache 来移除。

NOTES ON GENERIC MOUNT OPTIONS
通用挂载选项注意事项

Some of the general mount options from mount(8) that affect BTRFS and are worth mentioning.
一些来自 mount(8)的通用挂载选项会影响 BTRFS,并值得一提。

noatime

under read intensive work-loads, specifying noatime significantly improves performance because no new access time information needs to be written. Without this option, the default is relatime, which only reduces the number of inode atime updates in comparison to the traditional strictatime. The worst case for atime updates under relatime occurs when many files are read whose atime is older than 24 h and which are freshly snapshotted. In that case the atime is updated and COW happens - for each file - in bulk. See also https://lwn.net/Articles/499293/ - Atime and btrfs: a bad combination? (LWN, 2012-05-31).
在读取密集的工作负载下,指定 noatime 显著提高性能,因为不需要写入新的访问时间信息。没有此选项,默认为 relatime,与传统的 strictatime 相比,只减少了 inode atime 更新的次数。在 relatime 下,atime 更新的最坏情况是读取许多文件,这些文件的 atime 早于 24 小时,并且是新鲜的快照。在这种情况下,atime 会被更新,并且会批量发生 COW - 对于每个文件。另请参阅 https://lwn.net/Articles/499293/ - Atime 和 btrfs:一个糟糕的组合?(LWN,2012-05-31)。

Note that noatime may break applications that rely on atime uptimes like the venerable Mutt (unless you use maildir mailboxes).
请注意,noatime 可能会破坏依赖 atime 正常运行时间的应用程序,如古老的 Mutt(除非您使用 maildir 邮箱)。

Bootloaders 引导加载程序

GRUB2 (https://www.gnu.org/software/grub) has the most advanced support of booting from BTRFS with respect to features.
GRUB2(https://www.gnu.org/software/grub)在支持从 BTRFS 引导方面具有最先进的功能支持。

U-Boot (https://www.denx.de/wiki/U-Boot/) has decent support for booting but not all BTRFS features are implemented, check the documentation.
U-Boot(https://www.denx.de/wiki/U-Boot/)对启动有良好的支持,但并非所有 BTRFS 功能都已实现,请查阅文档。

In general, the first 1MiB on each device is unused with the exception of primary superblock that is on the offset 64KiB and spans 4KiB. The rest can be freely used by bootloaders or for other system information. Note that booting from a filesystem on zoned device is not supported.
一般来说,每个设备上的前 1MiB 未使用,主超级块除外,位于偏移 64KiB 处,跨越 4KiB。其余空间可自由供引导加载程序或其他系统信息使用。请注意,不支持从分区设备上的文件系统引导。

Filesystem limits 文件系统限制

maximum file name length 文件名长度最大限制

255

This limit is imposed by Linux VFS, the structures of BTRFS could store larger file names.
此限制是由 Linux VFS 强加的,BTRFS 的结构可以存储更大的文件名。

maximum symlink target length
符号链接目标的最大长度

depends on the nodesize value, for 4KiB it’s 3949 bytes, for larger nodesize it’s 4095 due to the system limit PATH_MAX
取决于节点大小值,对于 4KiB,它是 3949 字节,对于更大的节点大小,由于系统限制 PATH_MAX,它是 4095 字节。

The symlink target may not be a valid path, i.e. the path name components can exceed the limits (NAME_MAX), there’s no content validation at symlink(3) creation.
符号链接目标可能不是有效路径,即路径名组件可能超过限制(NAME_MAX),在创建符号链接(3)时没有内容验证。

maximum number of inodes 最大索引节点数

264 but depends on the available metadata space as the inodes are created dynamically
2 64 但取决于可用的元数据空间,因为索引节点是动态创建的。

Each subvolume is an independent namespace of inodes and thus their numbers, so the limit is per subvolume, not for the whole filesystem.
每个子卷是独立的索引节点命名空间,因此它们的数量是有限的,因此限制是针对每个子卷而不是整个文件系统。

inode numbers 索引节点编号

minimum number: 256 (for subvolumes), regular files and directories: 257, maximum number: (264 - 256)
最小数量:256(对于子卷),常规文件和目录:257,最大数量:(2 64 - 256)

The inode numbers that can be assigned to user created files are from the whole 64bit space except first 256 and last 256 in that range that are reserved for internal b-tree identifiers.
可分配给用户创建文件的索引节点号来自整个 64 位空间,除了该范围中保留给内部 B 树标识符的第一个 256 和最后一个 256 之外。

maximum file length 文件长度最大值

inherent limit of BTRFS is 264 (16 EiB) but the practical limit of Linux VFS is 263 (8 EiB)
BTRFS 的固有限制是 2 64 (16 EiB),但 Linux VFS 的实际限制是 2 63 (8 EiB)

maximum number of subvolumes
子卷的最大数量

the subvolume ids can go up to 248 but the number of actual subvolumes depends on the available metadata space
子卷的 ID 可以达到 2 48 ,但实际子卷的数量取决于可用的元数据空间

The space consumed by all subvolume metadata includes bookkeeping of shared extents can be large (MiB, GiB). The range is not the full 64bit range because of qgroups that use the upper 16 bits for another purposes.
所有子卷元数据占用的空间包括共享范围的簿记,可能会很大(MiB,GiB)。 由于 qgroups 使用上 16 位进行其他用途,因此范围不是完整的 64 位范围。

maximum number of hardlinks of a file in a directory
目录中文件的硬链接的最大数量

65536 when the extref feature is turned on during mkfs (default), roughly 100 otherwise and depends on file name length that fits into one metadata node
在 mkfs 期间打开 extref 功能时(默认情况下为 65536),否则大约为 100,取决于适合一个元数据节点的文件名长度

minimum filesystem size 文件系统最小大小

the minimal size of each device depends on the mixed-bg feature, without that (the default) it’s about 109MiB, with mixed-bg it’s is 16MiB
每个设备的最小大小取决于 mixed-bg 功能,如果没有(默认情况下),大约为 109MiB,使用 mixed-bg 则为 16MiB

Flexibility 灵活性 

The underlying design of BTRFS data structures allows a lot of flexibility and making changes after filesystem creation, like resizing, adding/removing space or enabling some features on-the-fly.
BTRFS 数据结构的基本设计允许灵活性很高,并且可以在文件系统创建后进行更改,如调整大小、添加/删除空间或在运行时启用某些功能。

  • dynamic inode creation -- there’s no fixed space or tables for tracking inodes so the number of inodes that can be created is bounded by the metadata space and its utilization
    动态索引节点创建 -- 没有固定的空间或表来跟踪索引节点,因此可以创建的索引节点数量受到元数据空间及其利用率的限制。

  • block group profile change on-the-fly -- the block group profiles can be changed on a mounted filesystem by running the balance operation and specifying the conversion filters (see balance)
    在运行时更改块组配置文件 -- 可以通过运行平衡操作并指定转换过滤器(参见平衡)在挂载的文件系统上更改块组配置文件。

  • resize -- the space occupied by the filesystem on each device can be resized up (grow) or down (shrink) as long as the amount of data can be still contained on the device
    调整大小 -- 每个设备上文件系统占用的空间可以向上(增大)或向下(缩小)调整,只要数据量仍然可以容纳在设备上

  • device management -- devices can be added, removed or replaced without requiring recreating the filesystem (mkfs), new redundancy options available on more devices can be also utilized by rebalancing
    设备管理 -- 可以添加、移除或替换设备,而无需重新创建文件系统(mkfs),在更多设备上提供的新冗余选项也可以通过重新平衡来利用