blob: 5e8de25bf0f1ec86aac76ad6a102d557b883603f [file] [log] [blame]
Jan Kara8e893462007-10-16 23:29:31 -07001
2Quota subsystem
3===============
4
5Quota subsystem allows system administrator to set limits on used space and
Jan Kara866c3662008-08-12 15:08:39 -07006number of used inodes (inode is a filesystem structure which is associated with
7each file or directory) for users and/or groups. For both used space and number
8of used inodes there are actually two limits. The first one is called softlimit
9and the second one hardlimit. An user can never exceed a hardlimit for any
10resource (unless he has CAP_SYS_RESOURCE capability). User is allowed to exceed
11softlimit but only for limited period of time. This period is called "grace
12period" or "grace time". When grace time is over, user is not able to allocate
13more space/inodes until he frees enough of them to get below softlimit.
Jan Kara8e893462007-10-16 23:29:31 -070014
15Quota limits (and amount of grace time) are set independently for each
16filesystem.
17
18For more details about quota design, see the documentation in quota-tools package
19(http://sourceforge.net/projects/linuxquota).
20
21Quota netlink interface
22=======================
23When user exceeds a softlimit, runs out of grace time or reaches hardlimit,
24quota subsystem traditionally printed a message to the controlling terminal of
25the process which caused the excess. This method has the disadvantage that
26when user is using a graphical desktop he usually cannot see the message.
27Thus quota netlink interface has been designed to pass information about
28the above events to userspace. There they can be captured by an application
29and processed accordingly.
30
31The interface uses generic netlink framework (see
32http://lwn.net/Articles/208755/ and http://people.suug.ch/~tgr/libnl/ for more
33details about this layer). The name of the quota generic netlink interface
34is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>.
35 Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
36This command is used to send a notification about any of the above mentioned
37events. Each message has six attributes. These are (type of the argument is
38in parentheses):
39 QUOTA_NL_A_QTYPE (u32)
40 - type of quota being exceeded (one of USRQUOTA, GRPQUOTA)
41 QUOTA_NL_A_EXCESS_ID (u64)
42 - UID/GID (depends on quota type) of user / group whose limit
43 is being exceeded.
44 QUOTA_NL_A_CAUSED_ID (u64)
45 - UID of a user who caused the event
46 QUOTA_NL_A_WARNING (u32)
47 - what kind of limit is exceeded:
48 QUOTA_NL_IHARDWARN - inode hardlimit
49 QUOTA_NL_ISOFTLONGWARN - inode softlimit is exceeded longer
50 than given grace period
51 QUOTA_NL_ISOFTWARN - inode softlimit
52 QUOTA_NL_BHARDWARN - space (block) hardlimit
53 QUOTA_NL_BSOFTLONGWARN - space (block) softlimit is exceeded
54 longer than given grace period.
55 QUOTA_NL_BSOFTWARN - space (block) softlimit
Jan Kara866c3662008-08-12 15:08:39 -070056 - four warnings are also defined for the event when user stops
57 exceeding some limit:
58 QUOTA_NL_IHARDBELOW - inode hardlimit
59 QUOTA_NL_ISOFTBELOW - inode softlimit
60 QUOTA_NL_BHARDBELOW - space (block) hardlimit
61 QUOTA_NL_BSOFTBELOW - space (block) softlimit
Jan Kara8e893462007-10-16 23:29:31 -070062 QUOTA_NL_A_DEV_MAJOR (u32)
63 - major number of a device with the affected filesystem
64 QUOTA_NL_A_DEV_MINOR (u32)
65 - minor number of a device with the affected filesystem