*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> quotas (4)              


quotas(4)							     quotas(4)

NAME    [Toc]    [Back]

     quotas - filesystem quota subsystem

DESCRIPTION    [Toc]    [Back]

     In	most computing environments, disk space	is not infinite.  The
     lbootable quotas subsystem	provides a mechanism to	control	usage of disk
     space.  Quotas can	be set for each	individual user	on any or all of the
     local filesystems.	 The quotas subsystem warns users when they exceed
     their allotted limit, but allows some extra space for current work	(hard
     limit/soft	limit).	 In addition, XFS filesystems with limit enforcement
     turned off	can be used as an effective disk usage accounting system.

   Users' Views	of Disk	Quotas
     To	most users, disk quotas	are either of no concern or a fact of life
     that cannot be avoided.  There are	two possible quotas that can be
     imposed; usually if one is	imposed, both are.  A limit can	be set on the
     amount of space a user can	occupy,	and there may be a limit on the	number
     of	files (inodes) he can own.

     The quota(1) command provides information on the quotas that have been
     set by the	system administrators and current usage.

     There are four numbers for	each limit:  current usage, soft limit
     (quota), hard limit, and time limit.  The soft limit is the number	of 1K
     blocks (or	files) that the	user is	expected to remain below.  The hard
     limit cannot be exceeded.	If a user's usage reaches the hard limit,
     further requests for space	(or attempts to	create a file) fail with an
     EDQUOT/ENOSPC error.

     When a user exceeds the soft limit, the timer is enabled.	Any time the
     quota drops below the soft	limits,	the timer is disabled.	If the timer
     pops, the particular limit	that has been exceeded is treated as if	the
     hard limit	has been reached, and no more resources	are allocated to the
     user.  The	only way to reset this condition, short	of turning off limit
     enforcement or increasing the limit, is to	reduce usage below quota.
     Only the superuser	can set	the time limits	and this is done on a per
     filesystem	basis.

   Surviving When the Quota Limit Is Reached    [Toc]    [Back]
     In	most cases, the	only way for a user to recover from over-quota
     conditions	is to abort whatever activity is in progress on	the filesystem
     that has reached its limit, remove	sufficient files to bring the limit
     back below	quota, and retry the failed program.

     However, if a user	is in the editor and a write fails because of an over
     quota situation, that is not a suitable course of action.	It is most
     likely that initially attempting to write the file	has truncated its
     previous contents,	so if the editor is aborted without correctly writing
     the file, not only	are the	recent changes lost, but possibly much,	or
     even all, of the contents that previously existed.

									Page 1

quotas(4)							     quotas(4)

     There are several possible	safe exits for a user caught in	this
     situation.	 He can	use the	editor ! shell escape command to examine his
     file space	and remove surplus files.  Alternatively, using	csh(1),	he can
     suspend the editor, remove	some files, then resume	it.  A third
     possibility is to write the file to some other filesystem (perhaps	to a
     file on /tmp) where the user's quota has not been exceeded.  Then after
     rectifying	the quota situation, the file can be moved back	to the
     filesystem	it belongs on.

   Administering the Quota System    [Toc]    [Back]
     Quotas is an lbootable subsystem that can be installed by the
     administrator.  A decision	as to what filesystems need to have quotas
     enabled needs to be made.	Usually, only filesystems that house users'
     home directories or other user files need to be subjected to the quota
     system.  If possible, /tmp	should be free of quotas.

     XFS and EFS quota systems share many characteristics. However, overall
     XFS offers	a richer set of	functionalities. We will explain the old EFS
     quota system first	and differences	in XFS afterwards.

   Administering the EFS Quota System    [Toc]    [Back]
     On	EFS filesystems, a file	by the name of quotas should be	created	in the
     root of the filesystems that are to have quotas.  This file should	be of
     size zero and should be writable only by root.  After deciding on the
     filesystems that will have	quotas,	the administrator then establishes
     quotas for	individual users.  The edquota(1M) command is used to actually
     set the limits desired upon each user.  Where a number of users are to be
     given the same quotas (a common occurrence) the -p	option to edquota
     allows this to be easily accomplished.  Unless explicitly given a quota,
     users have	no limits set on the amount of disk they can use or the	number
     of	files they can create.

     Once the quotas are set and ready to operate, the system must be informed
     to	enforce	quotas on the desired filesystems.  This is accomplished with
     the quotaon(1M) command.  For quotas to be	accurate, it should be enabled
     on	a local	filesystem immediately after the filesystem has	been mounted.
     quotaon either enables quotas for a particular filesystem or, with	the -a
     option, enables quotas for	each filesystem	indicated in /etc/fstab	as
     using quotas.  See	fstab(4) for details.  When the	quotas subsystem is

	  /usr/etc/quotaon -a

     can be automatically executed during system boot up time by /etc/rc2.
     The script	/etc/init.d/quotas handles enabling of quotas and it uses the
     chkconfig(1M) command to check the	quotas configuration flag to decide
     whether or	not to enable quotas.  Users can circumvent the	quotas
     mechanism by giving the files away	to other users with the	use of
     chown(1) or chown(2).  The	system administrator can prevent this by
     setting the variable restricted_chown to a	non-zero value (see intro(2)
     and lboot(1M)).

									Page 2

quotas(4)							     quotas(4)

     When quotas need to be disabled, the quotaoff(1M) command is used.
     However, if the filesystem	is about to be dismounted, the umount(1M)
     command disables quotas immediately before	the filesystem is unmounted.
     This is actually an effect	of the umount(2) system	call, and it
     guarantees	that the quota system is not disabled if the umount would fail
     because the filesystem is not idle.

     Periodically (certainly after each	reboot and when	quotas are first
     enabled for a filesystem),	the records retained in	the quota file should
     be	checked	for consistency	with the actual	number of blocks and files
     allocated to the user.  The quotacheck(1M)	command	is used	to accomplish
     this.  It is not necessary	to dismount the	filesystem or disable the
     quota system to run this command, though on active	filesystems inaccurate
     results may occur.	 This does no real harm	in most	cases; another run of
     quotacheck	when the filesystem is idle corrects any inaccuracy.
     quotacheck	can be run automatically during	boot up	via the	script
     /etc/init.d/quotas.  Since	quotacheck can take some time, there is	a
     chkconfig flag called quotacheck that controls whether or not to run
     quotacheck	at system boot up time.

     The superuser can use the quota command to	examine	the usage and quotas
     of	any user, and the repquota(1M) command can be used to check the	usages
     and limits	for all	users on a filesystem.

   Administering the XFS Quota System    [Toc]    [Back]
     The XFS quota system is different from that of EFS	in many	ways.

     o	  There	is no necessity	for a quotas file in the root of the XFS

     o	  XFS distinguishes between quota accounting and limit enforcement.
	  Quota	accounting must	be turned on at	the time of mounting the XFS
	  filesystem.  However,	it is possible to turn on/off limit
	  enforcement any time quota accounting	is turned on. The quota	option
	  in fstab(4) (or -o quota in mount(1M)	) turns	on both	quota
	  accounting and enforcement. The qnoenforce option must be used to
	  turn on accounting with limit	enforcement disabled.  quotaon(1M)
	  contains some	examples of frequently used procedures.

     o	  Turning on quotas on the root	filesystem is slightly different from
	  the above.  quotaon(1M) must be used on the root XFS filesystem
	  first; quotas	will be	turned on the next time	the system is
	  rebooted.  It	is useful to use repquota(1M) with the -s option to
	  monitor the effect of	quotaon/off at various stages.

     o	  quotacheck(1M) has no	effect on XFS filesystems. The first time
	  quota	accounting is turned on, XFS does an automatic quotacheck
	  internally; afterwards, the quota system will	always be completely
	  consistent until quotas are manually turned off.  Similarly,
	  /etc/chkconfig(1M) options quotas and	quotacheck are not needed for
	  XFS filesystems.

									Page 3

quotas(4)							     quotas(4)

     o	  repquota(1M) with the	-s option can be used to monitor the status of
	  the quota system of an XFS filesystem.  This can be used to see if
	  quotas are turned on,	given an XFS filesystem.  It can also be used
	  to monitor the space occupied	by the quota system itself.

     o	  repquota also	provides a -e option to	output the limits of all users
	  listed in /etc/passwd	to a file that can later be read in by
	  edquota(1M).	This is	useful in recreating the limits	of a large
	  number of users. A possible scenario would be	(a) creating the
	  output file using repquota, (b) turning off quotas and deleting all
	  the quota information	(including limits, etc), (c) mounting the XFS
	  filesystem back with quotas turned on, and (d) reading that file
	  containing limits of users using edquota.  This procedure will help
	  compact the quota information. Keeping all the limits	saved in a
	  file for later use will also help in case of a disaster because,
	  apart	from xfsdump(1M), backup utilities do not handle quota

     o	  edquota(1M) cannot be	used to	set quota limits before	turning	on
	  quotas on the	filesystem concerned.

     o	  XFS filesystems keep quota accounting	on the superuser, and quota -v
	  will display the superuser's usage information. However, limits are
	  never	enforced on the	superuser.

     o	  XFS filesystems keep quota accounting	whether	the user has quota
	  limits or not.

   Quota Implementation	Notes
     On	EFS filesystems, disk quota usage information is stored	in a file on
     the filesystem that the quotas are	to be applied to.  Conventionally,
     this file is called quotas, and resides at	the root of the	filesystem.
     While this	name is	not known to the system	in any way, several of the
     user level	utilities "know" it, and choosing any other name is not	wise.

     The data in the quotas file is stored in a	format different from
     Berkeley's	implementation.	 Any direct accesses to	the file by programs
     is	not recommended.  Instead, use the commands or the quotactl(2) system
     call to access or modify the quota	information.

     The system	is informed of the existence of	the quota file by the quotactl
     system call.  It then reads the quota entries for any open	files owned by
     users.  Each subsequent open of a file in the filesystem is accompanied
     by	a pairing with its quota information.  In memory, the quota
     information is kept hashed	by user	ID and filesystem and retained in an
     LRU chain so recently released data can be	easily reclaimed.

     Each time a block is accessed or released and each	time an	inode is
     allocated or freed, the quota system gets told about it and, in the case
     of	allocations, gets the opportunity to deny the allocation.

									Page 4

quotas(4)							     quotas(4)

     Note that the XFS quota system implementation is radically	different from
     that of EFS described above. XFS considers	quota information as
     filesystem	metadata and uses journalling to provide a higher level
     guarantee of consistency.	Among other things, it is worth	mentioning
     that XFS can keep accounting information for a very large number of
     active users efficiently.

BUGS    [Toc]    [Back]

     Currently,	it is not possible to enable quotas on XFS realtime

FILES    [Toc]    [Back]

     /etc/init.d/quotas	      script to	enable and disable quotas
     /etc/rc2.d/S14quotas     linked to	/etc/init.d/quotas
     /etc/config/quotas	      chkconfig	flag
     /etc/config/quotacheck   chkconfig	flag

SEE ALSO    [Toc]    [Back]

     mount(1M),	chkconfig(1M), edquota(1M), quota(1), quotacheck(1M), rc2(1M),
     repquota(1M), quotactl(2),	fstab(4).

									PPPPaaaaggggeeee 5555
[ Back ]
 Similar pages
Name OS Title
quotacheck OpenBSD filesystem quota consistency checker
quotacheck IRIX EFS filesystem quota consistency checker
rquotad IRIX remote quota server
rquotad Tru64 Remote quota server
quotaon Tru64 turns quota enforcement on or off
quotaoff Tru64 turns quota enforcement on or off
rpc.rquotad Tru64 Remote quota server
rquotad HP-UX remote quota server
rpc.rquotad FreeBSD remote quota server
rpc.rquotad OpenBSD remote quota server
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service