quotactl(2)
๐ quotactl(2) โ manipulate disk quotas ๐
okay bestie, so this is the page for quotactl and quotactl_fd, the Linux system calls that mess with disk quotas โ like the whole thing where a filesystem says "you get THIS much space, and not one byte more, bestie." ๐ฆ
๐ LIBRARY
Standard C library, aka libc, link it with -lc. ๐
โจ SYNOPSIS
#include <xfs/xqm.h> /* Definition of Q_X* and XFS_QUOTA_* constants
(or <linux/dqblk_xfs.h>; see NOTES) */
#include <sys/quota.h>
int quotactl(int op, const char *_Nullable special, int id,
caddr_t addr);
#include <xfs/xqm.h> /* Definition of Q_X* and XFS_QUOTA_* constants
(or <linux/dqblk_xfs.h>; see NOTES) */
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
int syscall(SYS_quotactl_fd, int fd, int op, int id, caddr_t addr);
two entry points, one vibe ๐ซ
๐ธ DESCRIPTION
The quota system sets per-user, per-group, and per-project limits on how much disk space each of them can use on a filesystem. For every user and/or group you can set a soft limit and a hard limit on each filesystem. The hard limit can't be exceeded, periodt. The soft limit can be exceeded, but warnings will ensue (the audacity, honestly ๐ญ). And here's the twist: you can't stay over the soft limit for longer than the grace period (one week by default). After that, the soft limit counts as a hard limit. no cap. ๐ฅ
The quotactl() and quotactl_fd() calls manipulate disk quotas. The difference between them is how you tell it which filesystem you mean, see the argument descriptions below. And if you're wondering which one to pick, the NOTES section has the tea. โ
The op argument is the operation to apply to the user or group ID given in id. To build op, use the QCMD(subop, type) macro. The type value is either USRQUOTA (user quotas), GRPQUOTA (group quotas), or โ since Linux 4.1 โ PRJQUOTA (project quotas). The subop value is explained right below. ๐
For quotactl(), special is a pointer to a null-terminated string holding the pathname of the (mounted) block special device for the filesystem you're manipulating. ๐ง
For quotactl_fd(), the fd argument is a file descriptor โ and yes it may be opened with the O_PATH flag โ pointing at a file or directory on the filesystem you're manipulating. ๐ซถ
The addr argument is the address of an optional, operation-specific data structure that gets copied in or out of the system. What addr means depends on the operation, and it's spelled out for each one below. ๐
So, subop is one of these operations:
Q_QUOTAON(Q_QUOTAON(2const)) ๐Q_QUOTAOFF(Q_QUOTAOFF(2const)) ๐Q_GETQUOTA(Q_GETQUOTA(2const)) ๐Q_GETNEXTQUOTA(Q_GETNEXTQUOTA(2const)) ๐Q_SETQUOTA(Q_SETQUOTA(2const)) ๐Q_GETINFO(Q_GETINFO(2const)) ๐Q_SETINFO(Q_SETINFO(2const)) ๐Q_GETFMT(Q_GETFMT(2const)) ๐Q_SYNC(Q_SYNC(2const)) ๐Q_GETSTATS(Q_GETSTATS(2const)) ๐
But wait โ for XFS filesystems using the XFS Quota Manager (XQM), all of the above gets bypassed entirely and you use these instead:
Q_XQUOTAON(Q_XQUOTAON(2const)) โจQ_XQUOTAOFF(Q_XQUOTAOFF(2const)) โจQ_XGETQUOTA(Q_XGETQUOTA(2const)) โจQ_XGETNEXTQUOTA(Q_XGETNEXTQUOTA(2const)) โจQ_XSETQLIM(Q_XSETQLIM(2const)) โจQ_XGETQSTAT(Q_XGETQSTAT(2const)) โจQ_XGETQSTATV(Q_XGETQSTATV(2const)) โจQ_XQUOTARM(Q_XQUOTARM(2const)) โจQ_XQUOTASYNC(Q_XQUOTASYNC(2const)) โจ
๐ฏ RETURN VALUE
Slay = 0 is returned. ๐
Not slay = -1 is returned and errno is set to tell you what went wrong. ๐
๐จ ERRORS
EFAULTโaddrorspecialis invalid. ๐EINVALโoportypeis invalid. ๐ENOENTโ the file specified byspecialoraddrdoes not exist. ๐ญENOSYSโ the kernel was not compiled with theCONFIG_QUOTAoption. ๐ENOTBLKโspecialis not a block device. ๐EPERMโ the caller lacked the required privilege (CAP_SYS_ADMIN) for the specified operation. ๐ (respectfully, you need the crown for this one)ESRCHโ no disk quota is found for the indicated user. Quotas have not been turned on for this filesystem. ๐
๐ NOTES
๐๏ธ Alternative XFS header
Instead of <xfs/xqm.h> you can use <linux/dqblk_xfs.h> โ just keep in mind there are several naming discrepancies, okurrr:
- Quota enabling flags (of format
XFS_QUOTA_[UGP]DQ_{ACCT,ENFD}) are defined without a leading "X", asFS_QUOTA_[UGP]DQ_{ACCT,ENFD}. ๐ - Same energy for the
XFS_{USER,GROUP,PROJ}_QUOTAquota type flags โ they're defined asFS_{USER,GROUP,PROJ}_QUOTA. ๐ - The
dqblk_xfs.hheader file defines its ownXQM_USRQUOTA,XQM_GRPQUOTA, andXQM_PRJQUOTAconstants for the available quota types, but their values are the same as for the constants without theXQM_prefix. ๐
โ๏ธ quotactl() versus quotactl_fd()
The original quotactl() variant of this system call requires you to specify the block device containing the filesystem to operate on. Which is lowkey a problem: it makes it impossible to use in cases where the filesystem has no backing block device at all (e.g., tmpfs ๐ญ). And even when the block device does exist, it might be a whole quest to find it โ it requires scanning /proc/self/mounts and even some filesystem-specific parsing in the case of, for example, bcachefs. ๐ตโ๐ซ
quotactl_fd() instead works on the mount point, which dodges that whole limitation and is simpler to use โ since the filesystem you want to manipulate is typically specified by its mount point anyway. main character energy honestly. ๐
๐ STANDARDS
Linux. ๐ง
๐ฐ๏ธ HISTORY
quotactl_fd()โ Linux 5.14. โจ
๐ SEE ALSO
quota(1), getrlimit(2), quotacheck(8), quotaon(8) ๐ซถ
okay that's the whole page bestie, go forth and quota responsibly ๐โจ
โ from Linux man-pages 6.20, dated 2026-06-05, signing off like the icon it is ๐๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1996, Andries E. Brouwer <aeb@cwi.nl>
- Copyright 2010, Jan Kara <jack@suse.cz>
- Copyright 2010, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms