|
NAMExfs_quota - manage use of quota on XFS filesystemsSYNOPSISxfs_quota [ -x ] [ -p prog ] [ -c cmd ] ... [ -d project ] ... [ path ... ]xfs_quota -V DESCRIPTIONxfs_quota is a utility for reporting and editing various aspects of filesystem quota.The options to xfs_quota are:
The optional path argument(s) can be used to specify mount points or device files which identify XFS filesystems. The output of the individual xfs_quota commands will then be restricted to the set of filesystems specified. This manual page is divided into two sections - firstly, information for users of filesystems with quota enabled, and the xfs_quota commands of interest to such users; and then information which is useful only to administrators of XFS filesystems using quota and the quota commands which allow modifications to the quota system. Note that common to almost all of the individual commands described below are the options for specifying which quota types are of interest - user quota (-u), group quota (-g), and/or project quota (-p). Also, several commands provide options to operate on "blocks used" (-b), "inodes used" (-i), and/or "realtime blocks used" (-r). Many commands also have extensive online help. Use the help command for more details on any command. QUOTA OVERVIEWIn most computing environments, disk space is not infinite. The quota subsystem provides a mechanism to control usage of disk space. Quotas can be set for each individual user on any/all of the local filesystems. The quota 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' View of Disk QuotasTo 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 - 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 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 the "Quota exceeded" (EDQUOT) 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 (i.e. a sufficiently capable process) can set the time limits and this is done on a per filesystem basis. Surviving When the Quota Limit Is ReachedIn 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. 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 sh(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. USER COMMANDS
quota [ -gpu ] [ -bir ] [ -hnNv ] [
-f file ] [ ID | name ] ...
free [ -bir ] [ -hN ] [ -f
file ]
help [ command ]
QUOTA ADMINISTRATIONThe XFS quota system differs to that of other filesystems in a number of ways. Most importantly, XFS considers quota information as filesystem metadata and uses journaling to provide a higher level guarantee of consistency. As such, it is administered differently, in particular:
ADMINISTRATOR COMMANDSpath [ N ]
report [ -gpu ] [ -bir ] [ -ahntLNU
] [ -f file ]
state [ -gpu ] [ -av ] [ -f
file ]
limit [ -gpu ] bsoft=N |
bhard=N | isoft=N | ihard=N |
rtbsoft=N | rtbhard=N -d | id |
name
timer [ -gpu ] [ -bir ] value
warn [ -gpu ] [ -bir ] value
-d | id | name
dump [ -gpu ] [ -f file ]
restore [ -gpu ] [ -f file ]
quot [ -gpu ] [ -bir ] [ -acnv ] [
-f file ]
project [ -cCs [ -d depth ] [
-p path ] id | name ]
DIRECTORY TREE QUOTAThe project quota mechanism in XFS can be used to implement a form of directory tree quota, where a specified directory and all of the files and subdirectories below it (i.e. a tree) can be restricted to using a subset of the available space in the filesystem.A managed tree must be setup initially using the -s option to the project command. The specified project name or identifier is matched to one or more trees defined in /etc/projects, and these trees are then recursively descended to mark the affected inodes as being part of that tree. This process sets an inode flag and the project identifier on every file in the affected tree. Once this has been done, new files created in the tree will automatically be accounted to the tree based on their project identifier. An attempt to create a hard link to a file in the tree will only succeed if the project identifier matches the project identifier for the tree. The xfs_io utility can be used to set the project ID for an arbitrary file, but this can only be done by a privileged user. A previously setup tree can be cleared from project quota control through use of the project -C option, which will recursively descend the tree, clearing the affected inodes from project quota control. Finally, the project -c option can be used to check whether a tree is setup, it reports nothing if the tree is correct, otherwise it reports the paths of inodes which do not have the project ID of the rest of the tree, or if the inode flag is not set. Option -d can be used to limit recursion level (-1 is infinite, 0 is top level only, 1 is first level ... ). Option -p adds possibility to specify project paths in command line without a need for /etc/projects to exist. Note that if projects file exists then it is also used. EXAMPLESEnabling quota enforcement on an XFS filesystem (restrict a user to a set amount of space).
Enabling project quota on an XFS filesystem (restrict files in log file directories to only using 1 gigabyte of space).
Same as above without a need for configuration files.
CAVEATSXFS implements delayed allocation (aka. allocate-on-flush) and this has implications for the quota subsystem. Since quota accounting can only be done when blocks are actually allocated, it is possible to issue (buffered) writes into a file and not see the usage immediately updated. Only when the data is actually written out, either via one of the kernels flushing mechanisms, or via a manual sync(2), will the usage reported reflect what has actually been written.In addition, the XFS allocation mechanism will always reserve the maximum amount of space required before proceeding with an allocation. If insufficient space for this reservation is available, due to the block quota limit being reached for example, this may result in the allocation failing even though there is sufficient space. Quota enforcement can thus sometimes happen in situations where the user is under quota and the end result of some operation would still have left the user under quota had the operation been allowed to run its course. This additional overhead is typically in the range of tens of blocks. Both of these properties are unavoidable side effects of the way XFS operates, so should be kept in mind when assigning block limits. BUGSQuota support for filesystems with realtime subvolumes is not yet implemented, nor is the quota warning mechanism (the Linux warnquota(8) tool can be used to provide similar functionality on that platform).FILES
IRIX SEE ALSOquotaon(1M), xfs(4).LINUX SEE ALSOwarnquota(8), xfs(5).SEE ALSOdf(1), mount(1), sync(2), projid(5), projects(5). Visit the GSP FreeBSD Man Page Interface. |