Debian Codegraph @

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