1BTRFS-QGROUP(8)                  Btrfs Manual                  BTRFS-QGROUP(8)
2
3
4

NAME

6       btrfs-qgroup - control the quota group of a btrfs filesystem
7

SYNOPSIS

9       btrfs qgroup <subcommand> <args>
10

DESCRIPTION

12       btrfs qgroup is used to control quota group (qgroup) of a btrfs
13       filesystem.
14
15           Note
16           To use qgroup you need to enable quota first using btrfs quota
17           enable command.
18
19           Warning
20           Qgroup is not stable yet and will impact performance in current
21           mainline kernel (v4.14).
22

QGROUP

24       Quota groups or qgroup in btrfs make a tree hierarchy, the leaf qgroups
25       are attached to subvolumes. The size limits are set per qgroup and
26       apply when any limit is reached in tree that contains a given
27       subvolume.
28
29       The limits are separated between shared and exclusive and reflect the
30       extent ownership. For example a fresh snapshot shares almost all the
31       blocks with the original subvolume, new writes to either subvolume will
32       raise towards the exclusive limit.
33
34       The qgroup identifiers conform to level/id where level 0 is reserved to
35       the qgroups associated with subvolumes. Such qgroups are created
36       automatically.
37
38       The qgroup hierarchy is built by commands create and assign.
39
40           Note
41           If the qgroup of a subvolume is destroyed, quota about the
42           subvolume will not be functional until qgroup 0/<subvolume id> is
43           created again.
44

SUBCOMMAND

46       assign [options] <src> <dst> <path>
47           Assign qgroup <src> as the child qgroup of <dst> in the btrfs
48           filesystem identified by <path>.
49
50           Options
51
52           --rescan
53               (default since: 4.19) Automatically schedule quota rescan if
54               the new qgroup assignment would lead to quota inconsistency.
55               See QUOTA RESCAN for more information.
56
57           --no-rescan
58               Explicitly ask not to do a rescan, even if the assignment will
59               make the quotas inconsistent. This may be useful for repeated
60               calls where the rescan would add unnecessary overhead.
61
62       create <qgroupid> <path>
63           Create a subvolume quota group.
64
65           For the 0/<subvolume id> qgroup, a qgroup can be created even
66           before the subvolume is created.
67
68       destroy <qgroupid> <path>
69           Destroy a qgroup.
70
71           If a qgroup is not isolated, meaning it is a parent or child
72           qgroup, then it can only be destroyed after the relationship is
73           removed.
74
75       limit [options] <size>|none [<qgroupid>] <path>
76           Limit the size of a qgroup to <size> or no limit in the btrfs
77           filesystem identified by <path>.
78
79           If <qgroupid> is not given, qgroup of the subvolume identified by
80           <path> is used if possible.
81
82           Options
83
84           -c
85               limit amount of data after compression. This is the default, it
86               is currently not possible to turn off this option.
87
88           -e
89               limit space exclusively assigned to this qgroup.
90
91       remove <src> <dst> <path>
92           Remove the relationship between child qgroup <src> and parent
93           qgroup <dst> in the btrfs filesystem identified by <path>.
94
95           Options
96
97           --rescan
98               (default since: 4.19) Automatically schedule quota rescan if
99               the removed qgroup relation would lead to quota inconsistency.
100               See QUOTA RESCAN for more information.
101
102           --no-rescan
103               Explicitly ask not to do a rescan, even if the removal will
104               make the quotas inconsistent. This may be useful for repeated
105               calls where the rescan would add unnecessary overhead.
106
107       show [options] <path>
108           Show all qgroups in the btrfs filesystem identified by <path>.
109
110           Options
111
112           -p
113               print parent qgroup id.
114
115           -c
116               print child qgroup id.
117
118           -r
119               print limit of referenced size of qgroup.
120
121           -e
122               print limit of exclusive size of qgroup.
123
124           -F
125               list all qgroups which impact the given path(include ancestral
126               qgroups)
127
128           -f
129               list all qgroups which impact the given path(exclude ancestral
130               qgroups)
131
132           --raw
133               raw numbers in bytes, without the B suffix.
134
135           --human-readable
136               print human friendly numbers, base 1024, this is the default
137
138           --iec
139               select the 1024 base for the following options, according to
140               the IEC standard.
141
142           --si
143               select the 1000 base for the following options, according to
144               the SI standard.
145
146           --kbytes
147               show sizes in KiB, or kB with --si.
148
149           --mbytes
150               show sizes in MiB, or MB with --si.
151
152           --gbytes
153               show sizes in GiB, or GB with --si.
154
155           --tbytes
156               show sizes in TiB, or TB with --si.
157
158           --sort=[+/-]<attr>[,[+/-]<attr>]...
159               list qgroups in order of <attr>.
160
161               <attr> can be one or more of
162               qgroupid,rfer,excl,max_rfer,max_excl.
163
164               Prefix '+' means ascending order and '-' means descending order
165               of <attr>. If no prefix is given, use ascending order by
166               default.
167
168               If multiple <attr>s is given, use comma to separate.
169
170           --sync
171               To retrieve information after updating the state of qgroups,
172               force sync of the filesystem identified by <path> before
173               getting information.
174

QUOTA RESCAN

176       The rescan reads all extent sharing metadata and updates the respective
177       qgoups accordingly.
178
179       The information consists of bytes owned exclusively (excl) or
180       shared/referred to (rfer). There’s no explicit information about which
181       extents are shared or owned exclusively. This means when qgroup
182       relationship changes, extent owners change and qgroup numbers are no
183       longer consistent unless we do a full rescan.
184
185       However there are cases where we can avoid a full rescan, if a
186       subvolume whose rfer number equals its excl number, which means all
187       bytes are exclusively owned, then assigning/removing this subvolume
188       only needs to add/subtract rfer number from its parent qgroup. This can
189       speed up the rescan.
190

EXAMPLES

192       Example 1. Make a parent group that has two quota group children
193
194       Given the following filesystem mounted at /mnt/my-vault
195
196           Label: none  uuid: 60d2ab3b-941a-4f22-8d1a-315f329797b2
197                  Total devices 1 FS bytes used 128.00KiB
198                  devid    1 size 5.00GiB used 536.00MiB path /dev/vdb
199
200       Enable quota and create subvolumes. Check subvolume ids.
201
202           $ cd /mnt/my-vault
203           $ btrfs quota enable .
204           $ btrfs subvolume create a
205           $ btrfs subvolume create b
206           $ btrfs subvolume list .
207
208           ID 261 gen 61 top level 5 path a
209           ID 262 gen 62 top level 5 path b
210
211       Create qgroup and set limit to 10MiB.
212
213           $ btrfs qgroup create 1/100 .
214           $ btrfs qgroup limit 10M 1/100 .
215           $ btrfs qgroup assign 0/261 1/100 .
216           $ btrfs qgroup assign 0/262 1/100 .
217
218       And check qgroups.
219
220           $ btrfs qgroup show .
221
222           qgroupid         rfer         excl
223           --------         ----         ----
224           0/5          16.00KiB     16.00KiB
225           0/261        16.00KiB     16.00KiB
226           0/262        16.00KiB     16.00KiB
227           1/100        32.00KiB     32.00KiB
228

EXIT STATUS

230       btrfs qgroup returns a zero exit status if it succeeds. Non zero is
231       returned in case of failure.
232

AVAILABILITY

234       btrfs is part of btrfs-progs. Please refer to the btrfs wiki
235       http://btrfs.wiki.kernel.org for further details.
236

SEE ALSO

238       mkfs.btrfs(8), btrfs-subvolume(8), btrfs-quota(8),
239
240
241
242Btrfs v5.15.1                     11/22/2021                   BTRFS-QGROUP(8)
Impressum