1BTRFS-PROPERTY(8) BTRFS BTRFS-PROPERTY(8)
2
3
4
6 btrfs-property - get/set/list properties for given filesystem object
7
9 btrfs property <subcommand> <args>
10
12 btrfs property is used to get/set/list property for given filesystem
13 object. The object can be an inode (file or directory), subvolume or
14 the whole filesystem.
15
16 btrfs property provides an unified and user-friendly method to tune
17 different btrfs properties instead of using the traditional method like
18 chattr(1) or lsattr(1).
19
20 Object types
21 A property might apply to several object types so in some cases it's
22 necessary to specify that explicitly, however it's not needed in the
23 most common case of files and directories.
24
25 The subcommands take parameter -t, use first letter as a shortcut
26 (f/s/d/i) of the type:
27
28 • filesystem
29
30 • subvolume
31
32 • device
33
34 • inode (file or directory)
35
36 Inode properties
37 compression
38 compression algorithm set for an inode (it's not possible to set
39 the compression level this way), possible values:
40
41 • lzo
42
43 • zlib
44
45 • zstd
46
47 • no or none - disable compression (equivalent to chattr +m)
48
49 • "" (empty string) - set the default value
50
51 NOTE:
52 This has changed in version 5.18 of btrfs-progs and re‐
53 quires kernel 5.14 or newer to work.
54
55 Subvolume properties
56 ro read-only flag of subvolume: true or false. Please also see sec‐
57 tion SUBVOLUME FLAGS in btrfs-subvolume(8) for possible implica‐
58 tions regarding incremental send.
59
60 Filesystem properties
61 label label of the filesystem. For an unmounted filesystem, provide a
62 path to a block device as object. For a mounted filesystem,
63 specify a mount point.
64
66 get [-t <type>] <object> [<name>]
67 Read value of a property name of btrfs object of given type,
68 empty name will read all of them
69
70 list [-t <type>] <object>
71 List available properties with their descriptions for the given
72 object.
73
74 set [-f] [-t <type>] <object> <name> <value>
75 Set value of property name on a given btrfs object.
76
77 Options
78
79 -f Force the change. Changing some properties may involve
80 safety checks or additional changes that depend on the
81 properties semantics.
82
84 Set compression on a file:
85
86 $ touch file1
87 $ btrfs prop get file1
88 [ empty output ]
89 $ btrfs prop set file1 compression zstd
90 $ btrfs prop get file1
91 compression=zstd
92
93 Make a writeable subvolume read-only:
94
95 $ btrfs subvol create subvol1
96 [ fill subvol1 with data ]
97 $ btrfs prop get subvol1
98 ro=false
99 $ btrfs prop set subvol1 ro true
100 ro=true
101
103 btrfs property returns a zero exit status if it succeeds. Non zero is
104 returned in case of failure.
105
107 btrfs is part of btrfs-progs. Please refer to the documentation at
108 https://btrfs.readthedocs.io.
109
111 mkfs.btrfs(8), lsattr(1), chattr(1)
112
113
114
115
1166.6.2 Nov 24, 2023 BTRFS-PROPERTY(8)