.\" Copyright 1996, Andries E. Brouwer .\" Copyright 2010, Jan Kara .\" Copyright 2010, Michael Kerrisk .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH quotactl 2 2026-06-05 "Linux man-pages 6.19" .SH NAME quotactl, quotactl_fd \- manipulate disk quotas .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#include " " /* Definition of " Q_X* " and " XFS_QUOTA_* \ " constants" .RB " (or " "; see NOTES) */" .B #include .P .BI "int quotactl(int " op ", const char *_Nullable " special ", int " id , .BI " caddr_t " addr ); .P .BR "#include " " /* Definition of " Q_X* " and " XFS_QUOTA_* \ " constants" .RB " (or " "; see NOTES) */" .BR "#include " " /* Definition of " SYS_* " constants */" .B #include .P .BI "int syscall(SYS_quotactl_fd, int " fd ", int " op ", int " id \ ", caddr_t " addr ); .fi .SH DESCRIPTION The quota system can be used to set per-user, per-group, and per-project limits on the amount of disk space used on a filesystem. For each user and/or group, a soft limit and a hard limit can be set for each filesystem. The hard limit can't be exceeded. The soft limit can be exceeded, but warnings will ensue. Moreover, the user can't exceed the soft limit for more than grace period duration (one week by default) at a time; after this, the soft limit counts as a hard limit. .P The .BR quotactl () and .BR quotactl_fd () calls manipulate disk quotas. The difference between these functions is the way the filesystem being manipulated is specified, see description of the arguments below. See NOTES for why one variant might be preferred over the other. .P The .I op argument indicates an operation to be applied to the user or group ID specified in .IR id . To initialize the .I op argument, use the .I QCMD(subop, type) macro. The .I type value is either .BR USRQUOTA , for user quotas, .BR GRPQUOTA , for group quotas, or (since Linux 4.1) .\" 847aac644e92e5624f2c153bab409bf713d5ff9a .BR PRJQUOTA , for project quotas. The .I subop value is described below. .P For .BR quotactl (), the .I special argument is a pointer to a null-terminated string containing the pathname of the (mounted) block special device for the filesystem being manipulated. .P For .BR quotactl_fd (), the .I fd argument is a file descriptor (which may be opened with the .B O_PATH flag) referring to a file or directory on the filesystem being manipulated. .P The .I addr argument is the address of an optional, operation-specific, data structure that is copied in or out of the system. The interpretation of .I addr is given with each operation below. .P The .I subop value is one of the following operations: .TP .BR Q_QUOTAON (2const) .TQ .BR Q_QUOTAOFF (2const) .TQ .BR Q_GETQUOTA (2const) .TQ .BR Q_GETNEXTQUOTA (2const) .TQ .BR Q_SETQUOTA (2const) .TQ .BR Q_GETINFO (2const) .TQ .BR Q_SETINFO (2const) .TQ .BR Q_GETFMT (2const) .TQ .BR Q_SYNC (2const) .TQ .BR Q_GETSTATS (2const) .P For XFS filesystems making use of the XFS Quota Manager (XQM), the above operations are bypassed and the following operations are used: .TP .BR Q_XQUOTAON (2const) .TQ .BR Q_XQUOTAOFF (2const) .TQ .BR Q_XGETQUOTA (2const) .TQ .BR Q_XGETNEXTQUOTA (2const) .TQ .BR Q_XSETQLIM (2const) .TQ .BR Q_XGETQSTAT (2const) .TQ .BR Q_XGETQSTATV (2const) .TQ .BR Q_XQUOTARM (2const) .TQ .BR Q_XQUOTASYNC (2const) .SH RETURN VALUE On success, 0 is returned; on error, \-1 is returned, and .I errno is set to indicate the error. .SH ERRORS .TP .B EFAULT .I addr or .I special is invalid. .TP .B EINVAL .I op or .I type is invalid. .TP .B ENOENT The file specified by .I special or .I addr does not exist. .TP .B ENOSYS The kernel has not been compiled with the .B CONFIG_QUOTA option. .TP .B ENOTBLK .I special is not a block device. .TP .B EPERM The caller lacked the required privilege .RB ( CAP_SYS_ADMIN ) for the specified operation. .TP .B ESRCH No disk quota is found for the indicated user. Quotas have not been turned on for this filesystem. .SH NOTES .SS Alternative XFS header Instead of .I one can use .IR , taking into account that there are several naming discrepancies: .IP \[bu] 3 Quota enabling flags (of format .BR XFS_QUOTA_[UGP]DQ_{ACCT,ENFD} ) are defined without a leading "X", as .BR FS_QUOTA_[UGP]DQ_{ACCT,ENFD} . .IP \[bu] The same is true for .B XFS_{USER,GROUP,PROJ}_QUOTA quota type flags, which are defined as .BR FS_{USER,GROUP,PROJ}_QUOTA . .IP \[bu] The .I dqblk_xfs.h header file defines its own .BR XQM_USRQUOTA , .BR XQM_GRPQUOTA , and .B XQM_PRJQUOTA constants for the available quota types, but their values are the same as for constants without the .B XQM_ prefix. .SS quotactl() versus quotactl_fd() The original .BR quotactl () variant of this system call requires specifying the block device containing the filesystem to operate on. This makes it impossible to use in cases where the filesystem has no backing block device (e.g., tmpfs). Even when the block device does exist, it might be difficult to locate (requires scanning .I /proc/self/mounts and even some filesystem-specific parsing in the case of, for example, bcachefs). .BR quotactl_fd () instead works on the mount point, which avoids this limitation and is simpler to use (since the filesystem to manipulate is typically specified by its mount point anyway). .SH STANDARDS Linux. .SH HISTORY .TP .BR quotactl_fd () Linux 5.14. .SH SEE ALSO .BR quota (1), .BR getrlimit (2), .BR quotacheck (8), .BR quotaon (8)