1BTRFS-SUBVOLUME(8) Btrfs Manual BTRFS-SUBVOLUME(8)
2
3
4
6 btrfs-subvolume - manage btrfs subvolumes
7
9 btrfs subvolume <subcommand> [<args>]
10
12 btrfs subvolume is used to create/delete/list/show btrfs subvolumes and
13 snapshots.
14
16 A subvolume is a part of filesystem with its own and independent
17 file/directory hierarchy. Subvolumes can share file extents. A snapshot
18 is also subvolume, but with a given initial content of the original
19 subvolume.
20
21 Note
22 A subvolume in btrfs is not like an LVM logical volume, which is
23 block-level snapshot while btrfs subvolumes are file extent-based.
24
25 A subvolume looks like a normal directory, with some additional
26 operations described below. Subvolumes can be renamed or moved, nesting
27 subvolumes is not restricted but has some implications regarding
28 snapshotting.
29
30 A subvolume in btrfs can be accessed in two ways:
31
32 · like any other directory that is accessible to the user
33
34 · like a separately mounted filesystem (options subvol or subvolid)
35
36 In the latter case the parent directory is not visible and accessible.
37 This is similar to a bind mount, and in fact the subvolume mount does
38 exactly that.
39
40 A freshly created filesystem is also a subvolume, called top-level,
41 internally has an id 5. This subvolume cannot be removed or replaced by
42 another subvolume. This is also the subvolume that will be mounted by
43 default, unless the default subvolume has been changed (see subcommand
44 set-default).
45
46 A snapshot is a subvolume like any other, with given initial content.
47 By default, snapshots are created read-write. File modifications in a
48 snapshot do not affect the files in the original subvolume.
49
51 create [-i <qgroupid>] [<dest>/]<name>
52 Create a subvolume <name> in <dest>.
53
54 If <dest> is not given, subvolume <name> will be created in the
55 current directory.
56
57 Options
58
59 -i <qgroupid>
60 Add the newly created subvolume to a qgroup. This option can be
61 given multiple times.
62
63 delete [options] <subvolume> [<subvolume>...]
64 Delete the subvolume(s) from the filesystem.
65
66 If <subvolume> is not a subvolume, btrfs returns an error but
67 continues if there are more arguments to process.
68
69 The corresponding directory is removed instantly but the data
70 blocks are removed later. The deletion does not involve full commit
71 by default due to performance reasons (as a consequence, the
72 subvolume may appear again after a crash). Use one of the --commit
73 options to wait until the operation is safely stored on the media.
74
75 Options
76
77 -c|--commit-after
78 wait for transaction commit at the end of the operation
79
80 -C|--commit-each
81 wait for transaction commit after deleting each subvolume
82
83 find-new <subvolume> <last_gen>
84 List the recently modified files in a subvolume, after <last_gen>
85 ID.
86
87 get-default <path>
88 Get the default subvolume of the filesystem <path>.
89
90 The output format is similar to subvolume list command.
91
92 list [options] [-G [+|-]<value>] [-C [+|-]<value>]
93 [--sort=rootid,gen,ogen,path] <path>
94 List the subvolumes present in the filesystem <path>.
95
96 For every subvolume the following information is shown by default.
97
98 ID <ID> top level <ID> path <path> where path is the relative path
99 of the subvolume to the top level subvolume. The subvolume’s ID may
100 be used by the subvolume set-default command, or at mount time via
101 the subvolid= option. If -p is given, then parent <ID> is added to
102 the output between ID and top level. The parent’s ID may be used at
103 mount time via the subvolrootid= option.
104
105 Options
106
107 -p
108 print parent ID.
109
110 -a
111 print all the subvolumes in the filesystem and distinguish
112 between absolute and relative path with respect to the given
113 <path>.
114
115 -c
116 print the ogeneration of the subvolume, aliases: ogen or origin
117 generation.
118
119 -g
120 print the generation of the subvolume.
121
122 -o
123 print only subvolumes below specified <path>.
124
125 -u
126 print the UUID of the subvolume.
127
128 -q
129 print the parent uuid of subvolumes (and snapshots).
130
131 -R
132 print the UUID of the sent subvolume, where the subvolume is
133 the result of a receive operation
134
135 -t
136 print the result as a table.
137
138 -s
139 only snapshot subvolumes in the filesystem will be listed.
140
141 -r
142 only readonly subvolumes in the filesystem will be listed.
143
144 -G [+|-]<value>
145 list subvolumes in the filesystem that its generation is >=, ⟨
146 or = value. '+' means >= value, '-' means <= value, If there is
147 neither '+' nor '-', it means = value.
148
149 -C [+|-]<value>
150 list subvolumes in the filesystem that its ogeneration is >=,
151 <= or = value. The usage is the same to -G option.
152
153 --sort=rootid,gen,ogen,path
154 list subvolumes in order by specified items. you can add '+' or
155 '-' in front of each items, '+' means ascending, '-' means
156 descending. The default is ascending.
157
158 for --sort you can combine some items together by ',', just
159 like --sort=+ogen,-gen,path,rootid.
160
161 set-default <id> <path>
162 Set the subvolume of the filesystem <path> which is mounted as
163 default.
164
165 The subvolume is identified by <id>, which is returned by the
166 subvolume list command.
167
168 show <path>
169 Show information of a given subvolume in the <path>.
170
171 snapshot [-r] <source> <dest>|[<dest>/]<name>
172 Create a writable/readonly snapshot of the subvolume <source> with
173 the name <name> in the <dest> directory.
174
175 If only <dest> is given, the subvolume will be named the basename
176 of <source>. If <source> is not a subvolume, btrfs returns an
177 error. If -r is given, the snapshot will be readonly.
178
179 sync <path> [subvolid...]
180 Wait until given subvolume(s) are completely removed from the
181 filesystem after deletion. If no subvolume id is given, wait until
182 all current deletion requests are completed, but do not wait for
183 subvolumes deleted meanwhile. The status of subvolume ids is
184 checked periodically.
185
186 Options
187
188 -s <N>
189 sleep N seconds between checks (default: 1)
190
192 btrfs subvolume returns a zero exit status if it succeeds. A non-zero
193 value is returned in case of failure.
194
196 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
197 http://btrfs.wiki.kernel.org for further details.
198
200 mkfs.btrfs(8), mount(8), btrfs-quota(8), btrfs-qgroup(8),
201
202
203
204Btrfs v4.9.1 08/06/2017 BTRFS-SUBVOLUME(8)