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