quota.txt 3.1 KB

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