btrfs-property(8)

SYNOPSIS 概要 

btrfs property <subcommand> <args>
btrfs 属性 <子命令> <参数>

DESCRIPTION 描述 

btrfs property is used to get/set/list property for given filesystem object. The object can be an inode (file or directory), subvolume or the whole filesystem.
btrfs 属性用于获取/设置/列出给定文件系统对象的属性。该对象可以是一个索引节点(文件或目录)、子卷或整个文件系统。

btrfs property provides an unified and user-friendly method to tune different btrfs properties instead of using the traditional method like chattr(1) or lsattr(1).
btrfs 属性提供了一种统一且用户友好的方法来调整不同的 btrfs 属性,而不是使用传统的方法,比如 chattr(1) 或 lsattr(1)。

Object types 对象类型 

A property might apply to several object types so in some cases it’s necessary to specify that explicitly, however it’s not needed in the most common case of files and directories.
一个属性可能适用于多种对象类型,因此在某些情况下有必要明确指定,但在文件和目录的最常见情况下则不需要。

The subcommands take parameter -t, use first letter as a shortcut (f/s/d/i) of the type:
子命令使用参数 -t,将类型的首字母(f/s/d/i)作为快捷方式:

  • filesystem 文件系统

  • subvolume 子卷

  • device 设备

  • inode (file or directory)
    inode(文件或目录)

Inode properties Inode 属性

compression 压缩

compression algorithm set for an inode (it’s not possible to set the compression level this way), possible values:
为 inode 设置的压缩算法(无法通过此方式设置压缩级别),可能的值:

  • lzo

  • zlib

  • zstd

  • no or none - disable compression (equivalent to chattr +m)
    无或无 - 禁用压缩(等同于 chattr +m

  • “” (empty string) - set the default value
    “”(空字符串)- 设置默认值

    Note 注意

    This has changed in version 5.18 of btrfs-progs and requires kernel 5.14 or newer to work.
    这在 btrfs-progs 的 5.18 版本中发生了变化,需要内核 5.14 或更新版本才能正常工作。

Subvolume properties 子卷属性 

ro

read-only flag of subvolume: true or false. Please also see section SUBVOLUME FLAGS in btrfs-subvolume(8) for possible implications regarding incremental send.
子卷的只读标志:true 或 false。还请参阅 btrfs-subvolume(8) 中的 SUBVOLUME FLAGS 部分,了解增量发送可能产生的影响。

Filesystem properties 文件系统属性

label 标签

label of the filesystem. For an unmounted filesystem, provide a path to a block device as object. For a mounted filesystem, specify a mount point.
文件系统的标签。对于未挂载的文件系统,请提供一个块设备的路径作为对象。对于已挂载的文件系统,请指定挂载点。

SUBCOMMAND 子命令 

get [-t <type>] <object> [<name>]
获取 [-t <类型>] <对象> [<名称>]

Read value of a property name of btrfs object of given type, empty name will read all of them
读取给定类型的 btrfs 对象的属性名称的值,空名称将读取它们的所有内容

list [-t <type>] <object>
列出 [-t <类型>] <对象>

List available properties with their descriptions for the given object.
列出给定对象的可用属性及其描述。

set [-f] [-t <type>] <object> <name> <value>
设置给定 btrfs 对象上属性名称的值。

Set value of property name on a given btrfs object.
设置 [-f] [-t <type>] <object> <name> <value>。

Options

-f

Force the change. Changing some properties may involve safety checks or additional changes that depend on the properties semantics.
强制更改。更改某些属性可能涉及安全检查或依赖于属性语义的其他更改。

EXAMPLES 示例

Set compression on a file:
在文件上设置压缩:

$ touch file1
$ btrfs prop get file1
[ empty output ]
$ btrfs prop set file1 compression zstd
$ btrfs prop get file1
compression=zstd

Make a writeable subvolume read-only:
将可写子卷变为只读:

$ btrfs subvol create subvol1
[ fill subvol1 with data ]
$ btrfs prop get subvol1
ro=false
$ btrfs prop set subvol1 ro true
ro=true

EXIT STATUS 退出状态 

btrfs property returns a zero exit status if it succeeds. Non zero is returned in case of failure.
btrfs 属性在成功时返回零退出状态。失败时返回非零值。

AVAILABILITY 可用性 

btrfs is part of btrfs-progs. Please refer to the documentation at https://btrfs.readthedocs.io.
btrfs 是 btrfs-progs 的一部分。请参考 https://btrfs.readthedocs.io 上的文档。

SEE ALSO 参见 

mkfs.btrfs(8), lsattr(1), chattr(1)