Debian Codegraph @

upstream/opensuse-leap-16-1/man8/btrfs-qgroup.8

raw
1 .\" Man page generated from reStructuredText.
2 .
3 .
4 .nr rst2man-indent-level 0
5 .
6 .de1 rstReportMargin
7 \\$1 \\n[an-margin]
8 level \\n[rst2man-indent-level]
9 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
10 -
11 \\n[rst2man-indent0]
12 \\n[rst2man-indent1]
13 \\n[rst2man-indent2]
14 ..
15 .de1 INDENT
16 .\" .rstReportMargin pre:
17 . RS \\$1
18 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
19 . nr rst2man-indent-level +1
20 .\" .rstReportMargin post:
21 ..
22 .de UNINDENT
23 . RE
24 .\" indent \\n[an-margin]
25 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
26 .nr rst2man-indent-level -1
27 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29 ..
30 .TH "BTRFS-QGROUP" "8" "Mar 26, 2025" "6.14" "BTRFS"
31 .SH NAME
32 btrfs-qgroup \- control the quota group of a btrfs filesystem
33 .SH SYNOPSIS
34 .sp
35 \fBbtrfs qgroup\fP <subcommand> <args>
36 .SH DESCRIPTION
37 .sp
38 \fBbtrfs qgroup\fP is used to control quota group (qgroup) of a btrfs filesystem.
39 .sp
40 \fBNOTE:\fP
41 .INDENT 0.0
42 .INDENT 3.5
43 To use qgroup you need to enable quota first using \fBbtrfs quota enable\fP
44 command.
45 .UNINDENT
46 .UNINDENT
47 .sp
48 \fBWARNING:\fP
49 .INDENT 0.0
50 .INDENT 3.5
51 Qgroup is not stable yet and will impact performance in current mainline
52 kernel (v4.14).
53 .UNINDENT
54 .UNINDENT
55 .SH QGROUP
56 .sp
57 Quota groups or qgroup in btrfs make a tree hierarchy, the leaf qgroups are
58 attached to subvolumes. The size limits are set per qgroup and apply when any
59 limit is reached in tree that contains a given subvolume.
60 .sp
61 The limits are separated between shared and exclusive and reflect the extent
62 ownership. For example a fresh snapshot shares almost all the blocks with the
63 original subvolume, new writes to either subvolume will raise towards the
64 exclusive limit.
65 .sp
66 \fBNOTE:\fP
67 .INDENT 0.0
68 .INDENT 3.5
69 Qgroup limit only works when qgroup is in a consistent state.
70 If some workload marks qgroup inconsistent (like assigning a qgroup to another
71 qgroup), the limit will no longer work until the inconsistent flag is cleared
72 by \fBbtrfs quota rescan\fP\&.
73 .UNINDENT
74 .UNINDENT
75 .sp
76 The qgroup identifiers conform to \fIlevel/id\fP where level 0 is reserved to the
77 qgroups associated with subvolumes. Such qgroups are created automatically.
78 .sp
79 The qgroup hierarchy is built by commands \fBcreate\fP and \fBassign\fP\&.
80 .sp
81 \fBNOTE:\fP
82 .INDENT 0.0
83 .INDENT 3.5
84 If the qgroup of a subvolume is destroyed, quota about the subvolume will
85 not be functional until qgroup \fI0/<subvolume id>\fP is created again.
86 .UNINDENT
87 .UNINDENT
88 .SH SUBCOMMAND
89 .INDENT 0.0
90 .TP
91 .B assign [options] <src> <dst> <path>
92 Assign qgroup \fIsrc\fP as the child qgroup of \fIdst\fP in the btrfs filesystem
93 identified by \fIpath\fP\&.
94 .sp
95 \fBOptions\fP
96 .INDENT 7.0
97 .TP
98 .B \-\-rescan
99 (default since: 4.19) Automatically schedule quota rescan if the new qgroup
100 assignment would lead to quota inconsistency. See \fIQUOTA RESCAN\fP for more
101 information.
102 .TP
103 .B \-\-no\-rescan
104 Explicitly ask not to do a rescan, even if the assignment will make the quotas
105 inconsistent. This may be useful for repeated calls where the rescan would add
106 unnecessary overhead.
107 .UNINDENT
108 .TP
109 .B create <qgroupid> <path>
110 Create a subvolume quota group.
111 .sp
112 For the \fI0/<subvolume id>\fP qgroup, a qgroup can be created even before the
113 subvolume is created.
114 .TP
115 .B destroy <qgroupid> <path>
116 Destroy a qgroup.
117 .sp
118 If a qgroup is not isolated, meaning it is a parent or child qgroup, then it
119 can only be destroyed after the relationship is removed.
120 .TP
121 .B clear\-stale <path>
122 Clear all stale qgroups whose subvolume does not exist anymore, this is the
123 level 0 qgroup like 0/subvolid. Higher level qgroups are not deleted even
124 if they don\(aqt have any child qgroups.
125 .TP
126 .B limit [options] <size>|none [<qgroupid>] <path>
127 Limit the size of a qgroup to \fIsize\fP or no limit in the btrfs filesystem
128 identified by \fIpath\fP\&.
129 .sp
130 If \fIqgroupid\fP is not given, qgroup of the subvolume identified by \fIpath\fP
131 is used if possible.
132 .sp
133 \fBOptions\fP
134 .INDENT 7.0
135 .TP
136 .B \-c
137 limit amount of data after compression. This is the default, it is currently not
138 possible to turn off this option.
139 .TP
140 .B \-e
141 limit space exclusively assigned to this qgroup.
142 .UNINDENT
143 .TP
144 .B remove <src> <dst> <path>
145 Remove the relationship between child qgroup \fIsrc\fP and parent qgroup \fIdst\fP in
146 the btrfs filesystem identified by \fIpath\fP\&.
147 .sp
148 \fBOptions\fP
149 .INDENT 7.0
150 .TP
151 .B \-\-rescan
152 (default since: 4.19) Automatically schedule quota rescan if the removed qgroup
153 relation would lead to quota inconsistency. See \fIQUOTA RESCAN\fP for more
154 information.
155 .TP
156 .B \-\-no\-rescan
157 Explicitly ask not to do a rescan, even if the removal will make the quotas
158 inconsistent. This may be useful for repeated calls where the rescan would add
159 unnecessary overhead.
160 .UNINDENT
161 .TP
162 .B show [options] <path>
163 Show all qgroups in the btrfs filesystem identified by <path>.
164 .sp
165 \fBOptions\fP
166 .INDENT 7.0
167 .TP
168 .B \-p
169 print parent qgroup id.
170 .TP
171 .B \-c
172 print child qgroup id.
173 .TP
174 .B \-r
175 print limit of referenced size of qgroup.
176 .TP
177 .B \-e
178 print limit of exclusive size of qgroup.
179 .TP
180 .B \-F
181 list all qgroups which impact the given path(include ancestral qgroups)
182 .TP
183 .B \-f
184 list all qgroups which impact the given path(exclude ancestral qgroups)
185 .TP
186 .B \-\-raw
187 raw numbers in bytes, without the \fIB\fP suffix.
188 .TP
189 .B \-\-human\-readable
190 print human friendly numbers, base 1024, this is the default
191 .TP
192 .B \-\-iec
193 select the 1024 base for the following options, according to the IEC standard.
194 .TP
195 .B \-\-si
196 select the 1000 base for the following options, according to the SI standard.
197 .TP
198 .B \-\-kbytes
199 show sizes in KiB, or kB with \-\-si.
200 .TP
201 .B \-\-mbytes
202 show sizes in MiB, or MB with \-\-si.
203 .TP
204 .B \-\-gbytes
205 show sizes in GiB, or GB with \-\-si.
206 .TP
207 .B \-\-tbytes
208 show sizes in TiB, or TB with \-\-si.
209 .UNINDENT
210 .INDENT 7.0
211 .TP
212 .B \-\-sort=[+/\-]<attr>[,[+/\-]<attr>]...
213 list qgroups in order of <attr>.
214 .sp
215 <attr> can be one or more of qgroupid,rfer,excl,max_rfer,max_excl.
216 .sp
217 Prefix \fI+\fP means ascending order and \fI\-\fP means descending order of \fIattr\fP\&.
218 If no prefix is given, use ascending order by default.
219 .sp
220 If multiple \fIattr\fP values are given, use comma to separate.
221 .UNINDENT
222 .INDENT 7.0
223 .TP
224 .B \-\-sync
225 To retrieve information after updating the state of qgroups,
226 force sync of the filesystem identified by \fIpath\fP before getting information.
227 .UNINDENT
228 .UNINDENT
229 .SH SPECIAL PATHS
230 .sp
231 For \fIbtrfs qgroup show\fP subcommand, the \fBpath\fP column may has some special
232 strings:
233 .INDENT 0.0
234 .TP
235 .B \fI<toplevel>\fP
236 The toplevel subvolume
237 .TP
238 .B \fI<under deletion>\fP
239 The subvolume has been deleted (it\(aqs directory removed), but the
240 subvolume metadata not not yet fully cleaned.
241 .TP
242 .B \fI<squota space holder>\fP
243 For simple quota mode only.
244 By its design, a fully deleted subvolume may still have accounting on
245 it, so even the subvolume is gone, the numbers are still here for future
246 accounting.
247 .TP
248 .B \fI<stale>\fP
249 The qgroup has no corresponding subvolume anymore, and the qgroup
250 can be cleaned up under most cases.
251 The only exception is that, if the qgroup numbers are inconsistent and
252 the qgroup numbers are not all zeros, some older kernels may refuse to
253 delete such qgroups until a full rescan.
254 .UNINDENT
255 .SH QUOTA RESCAN
256 .sp
257 The rescan reads all extent sharing metadata and updates the respective qgroups
258 accordingly.
259 .sp
260 The information consists of bytes owned exclusively (\fIexcl\fP) or shared/referred
261 to (\fIrfer\fP). There\(aqs no explicit information about which extents are shared or
262 owned exclusively. This means when qgroup relationship changes, extent owners
263 change and qgroup numbers are no longer consistent unless we do a full rescan.
264 .sp
265 However there are cases where we can avoid a full rescan, if a subvolume whose
266 \fIrfer\fP number equals its \fIexcl\fP number, which means all bytes are exclusively
267 owned, then assigning/removing this subvolume only needs to add/subtract \fIrfer\fP
268 number from its parent qgroup. This can speed up the rescan.
269 .SH EXAMPLES
270 .SS Make a parent group that has two quota group children
271 .sp
272 Given the following filesystem mounted at \fB/mnt/my\-vault\fP
273 .INDENT 0.0
274 .INDENT 3.5
275 .sp
276 .EX
277 Label: none uuid: 60d2ab3b\-941a\-4f22\-8d1a\-315f329797b2
278 Total devices 1 FS bytes used 128.00KiB
279 devid 1 size 5.00GiB used 536.00MiB path /dev/vdb
280 .EE
281 .UNINDENT
282 .UNINDENT
283 .sp
284 Enable quota and create subvolumes. Check subvolume ids.
285 .INDENT 0.0
286 .INDENT 3.5
287 .sp
288 .EX
289 $ cd /mnt/my\-vault
290 $ btrfs quota enable .
291 $ btrfs subvolume create a
292 $ btrfs subvolume create b
293 $ btrfs subvolume list .
294
295 ID 261 gen 61 top level 5 path a
296 ID 262 gen 62 top level 5 path b
297 .EE
298 .UNINDENT
299 .UNINDENT
300 .sp
301 Create qgroup and set limit to 10MiB.
302 .INDENT 0.0
303 .INDENT 3.5
304 .sp
305 .EX
306 $ btrfs qgroup create 1/100 .
307 $ btrfs qgroup limit 10M 1/100 .
308 $ btrfs qgroup assign 0/261 1/100 .
309 $ btrfs qgroup assign 0/262 1/100 .
310 .EE
311 .UNINDENT
312 .UNINDENT
313 .sp
314 And check qgroups.
315 .INDENT 0.0
316 .INDENT 3.5
317 .sp
318 .EX
319 $ btrfs qgroup show .
320
321 qgroupid rfer excl
322 \-\-\-\-\-\-\-\- \-\-\-\- \-\-\-\-
323 0/5 16.00KiB 16.00KiB
324 0/261 16.00KiB 16.00KiB
325 0/262 16.00KiB 16.00KiB
326 1/100 32.00KiB 32.00KiB
327 .EE
328 .UNINDENT
329 .UNINDENT
330 .SH EXIT STATUS
331 .sp
332 \fBbtrfs qgroup\fP returns a zero exit status if it succeeds. Non zero is
333 returned in case of failure.
334 .SH AVAILABILITY
335 .sp
336 \fBbtrfs\fP is part of btrfs\-progs. Please refer to the documentation at
337 \X'tty: link https://btrfs.readthedocs.io'\fI\%https://btrfs.readthedocs.io\fP\X'tty: link'\&.
338 .SH SEE ALSO
339 .sp
340 \fI\%btrfs\-quota(8)\fP,
341 \fI\%btrfs\-subvolume(8)\fP,
342 \fI\%mkfs.btrfs(8)\fP
343 .\" Generated by docutils manpage writer.
344 .