1 .\" Copyright (c) 2010, Jan Kara
2 .\" A few pieces copyright (c) 1996 Andries Brouwer (aeb@cwi.nl)
3 .\" and copyright 2010 (c) Michael Kerrisk <mtk.manpages@gmail.com>
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of
11 .\" this manual under the conditions for verbatim copying, provided that
12 .\" the entire resulting derived work is distributed under the terms of
13 .\" a permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume
17 .\" no responsibility for errors or omissions, or for damages resulting
18 .\" from the use of the information contained herein. The author(s) may
19 .\" not have taken the same level of care in the production of this
20 .\" manual, which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
27 .TH QUOTACTL 2 2010-06-16 "Linux" "Linux Programmer's Manual"
29 quotactl \- manipulate disk quotas
32 .B #include <sys/quota.h>
33 .B #include <xfs/xqm.h>
35 .BI "int quotactl(int " cmd ", const char *" special ", int " id \
40 The quota system can be used to set per-user and per-group limits on the
41 amount of disk space used on a filesystem.
42 For each user and/or group,
43 a soft limit and a hard limit can be set for each filesystem.
44 The hard limit can't be exceeded.
45 The soft limit can be exceeded, but warnings will ensue.
46 Moreover, the user can't exceed the soft limit for more than one week
47 (by default) at a time;
48 after this time, the soft limit counts as a hard limit.
52 call manipulates disk quotas.
55 argument indicates a command to be applied to the user or
61 .IR "QCMD(subcmd, type)"
73 value is described below.
77 argument is a pointer to a null-terminated string containing the pathname
78 of the (mounted) block special device for the filesystem being manipulated.
82 argument is the address of an optional, command-specific, data structure
83 that is copied in or out of the system.
86 is given with each command below.
90 value is one of the following:
93 Turn on quotas for a filesystem.
96 argument is the identification number of the quota format to be used.
97 Currently, there are three supported quota formats:
101 The original quota format.
104 The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs
105 and quota limits up to 2^42 bytes and 2^32 inodes.
108 A quota format that can handle 32-bit UIDs and GIDs
109 and quota limits of 2^64 bytes and 2^64 inodes.
114 argument points to the pathname of a file containing the quotas for
116 The quota file must exist; it is normally created with the
119 This operation requires privilege
120 .RB ( CAP_SYS_ADMIN ).
123 Turn off quotas for a filesystem.
128 arguments are ignored.
129 This operation requires privilege
130 .RB ( CAP_SYS_ADMIN ).
133 Get disk quota limits and current usage for user or group
137 argument is a pointer to a
145 /* uint64_t is an unsigned 64\-bit integer;
146 uint32_t is an unsigned 32\-bit integer */
148 struct dqblk { /* Definition since Linux 2.4.22 */
149 uint64_t dqb_bhardlimit; /* absolute limit on disk
150 quota blocks alloc */
151 uint64_t dqb_bsoftlimit; /* preferred limit on
153 uint64_t dqb_curspace; /* current quota block
155 uint64_t dqb_ihardlimit; /* maximum number of
157 uint64_t dqb_isoftlimit; /* preferred inode limit */
158 uint64_t dqb_curinodes; /* current number of
160 uint64_t dqb_btime; /* time limit for excessive
162 uint64_t dqb_itime; /* time limit for excessive
164 uint32_t dqb_valid; /* bit mask of QIF_*
168 /* Flags in dqb_valid that indicate which fields in
169 dqblk structure are valid. */
171 #define QIF_BLIMITS 1
173 #define QIF_ILIMITS 4
177 #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
178 #define QIF_USAGE (QIF_SPACE | QIF_INODES)
179 #define QIF_TIMES (QIF_BTIME | QIF_ITIME)
180 #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
186 field is a bit mask that is set to indicate the entries in the
188 structure that are valid.
189 Currently, the kernel fills in all entries of the
191 structure and marks them as valid in the
194 Unprivileged users may retrieve only their own quotas;
196 .RB ( CAP_SYS_ADMIN )
197 can retrieve the quotas of any user.
200 Set quota information for user or group
202 using the information supplied in the
204 structure pointed to by
210 structure indicates which entries in the structure have been set by the caller.
211 This operation supersedes the
215 operations in the previous quota interfaces.
216 This operation requires privilege
217 .RB ( CAP_SYS_ADMIN ).
220 Get information (like grace times) about quotafile.
223 argument should be a pointer to a
226 This structure is defined in
232 /* uint64_t is an unsigned 64\-bit integer;
233 uint32_t is an unsigned 32\-bit integer */
235 struct dqinfo { /* Defined since kernel 2.4.22 */
236 uint64_t dqi_bgrace; /* Time before block soft limit
237 becomes hard limit */
239 uint64_t dqi_igrace; /* Time before inode soft limit
240 becomes hard limit */
241 uint32_t dqi_flags; /* Flags for quotafile
246 /* Bits for dqi_flags */
248 /* Quota format QFMT_VFS_OLD */
250 #define V1_DQF_RSQUASH 1 /* Root squash enabled */
252 /* Other quota formats have no dqi_flags bits defined */
254 /* Flags in dqi_valid that indicate which fields in
255 dqinfo structure are valid. */
257 # define IIF_BGRACE 1
258 # define IIF_IGRACE 2
260 # define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
268 structure indicates the entries in the structure that are valid.
269 Currently, the kernel fills in all entries of the
271 structure and marks them all as valid in the
279 Set information about quotafile.
282 argument should be a pointer to a
289 structure indicates the entries in the structure
290 that have been set by the caller.
291 This operation supersedes the
295 operations in the previous quota interfaces.
299 This operation requires privilege
300 .RB ( CAP_SYS_ADMIN ).
303 Get quota format used on the specified filesystem.
306 argument should be a pointer to a 4-byte buffer
307 where the format number will be stored.
310 Update the on-disk copy of quota usages for a filesystem.
313 is NULL, then all filesystems with active quotas are sync'ed.
318 arguments are ignored.
321 Get statistics and other generic information about the quota subsystem.
324 argument should be a pointer to a
326 structure in which data should be stored.
327 This structure is defined in
333 arguments are ignored.
334 This operation is obsolete and not supported by recent kernels.
335 .\" Q_GETSTATS was removed in kernel 2.4.22.
337 .I /proc/sys/fs/quota/
338 carry the information instead.
340 For XFS filesystems making use of the XFS Quota Manager (XQM),
341 the above commands are bypassed and the following commands are used:
344 Turn on quotas for an XFS filesystem.
345 XFS provides the ability to turn on/off quota limit enforcement
346 with quota accounting.
347 Therefore, XFS expects
349 to be a pointer to an
351 that contains either the flags
352 .B XFS_QUOTA_UDQ_ACCT
354 .B XFS_QUOTA_UDQ_ENFD
356 .B XFS_QUOTA_GDQ_ACCT
358 .B XFS_QUOTA_GDQ_ENFD
359 (for group quota), as defined in
361 This operation requires privilege
362 .RB ( CAP_SYS_ADMIN ).
365 Turn off quotas for an XFS filesystem.
368 XFS filesystems expect a pointer to an
370 that specifies whether quota accounting and/or limit enforcement need
372 This operation requires privilege
373 .RB ( CAP_SYS_ADMIN ).
376 Get disk quota limits and current usage for user
380 argument is a pointer to an
382 structure (defined in
384 Unprivileged users may retrieve only their own quotas;
386 .RB ( CAP_SYS_ADMIN )
387 may retrieve the quotas of any user.
390 Set disk quota limits for user
394 argument is a pointer to an
396 structure (defined in
398 This operation requires privilege
399 .RB ( CAP_SYS_ADMIN ).
404 structure containing XFS filesystem-specific quota information.
405 This is useful for finding out how much space is used to store quota
406 information, and also to get quotaon/off status of a given local XFS
410 Free the disk space taken by disk quotas.
411 Quotas must have already been turned off.
413 There is no command equivalent to
417 writes quota information to disk (in addition to the other filesystem
418 metadata that it writes out).
423 returns 0; on error \-1
426 is set to indicate the error.
442 The file specified by
449 The kernel has not been compiled with the
455 is not a block device.
458 The caller lacked the required privilege
459 .RB ( CAP_SYS_ADMIN )
460 for the specified operation.
463 No disk quota is found for the indicated user.
464 Quotas have not been turned on for this filesystem.
476 Specified limits are out of range allowed by quota format.
488 The quota file pointed to by
490 exists, but is not a regular file; or,
491 the quota file pointed to by
493 exists, but is not on the filesystem pointed to by
498 attempted, but another
500 had already been performed.
503 The quota file is corrupted.
506 Specified quota format was not found.
513 This page is part of release 3.78 of the Linux
516 A description of the project,
517 information about reporting bugs,
518 and the latest version of this page,
520 \%http://www.kernel.org/doc/man\-pages/.