]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - man/man8/xfs_quota.8
Fix up compiler warnings and other issues when building on IRIX.
[thirdparty/xfsprogs-dev.git] / man / man8 / xfs_quota.8
CommitLineData
42cf2b97
NS
1.TH xfs_quota 8
2.SH NAME
3xfs_quota \- manage use of quota on XFS filesystems
4.SH SYNOPSIS
5.nf
6\f3xfs_quota\f1 [ \f3\-x\f1 ] [ \f3\-p\f1 prog ] [ \f3\-c\f1 cmd ] ...
7 [ \f3\-d\f1 project ] ... [path...]
8.fi
9.SH DESCRIPTION
10\f2xfs_quota\f1 is a utility for reporting and editing various
11aspects of filesystem quota.
12.PP
13The options to \f2xfs_quota\f1 are:
14.TP 10
15\f3\-c\f1 \f2cmd\f1
16\f2xfs_quota\f1 commands may be run interactively (the default)
17or as arguments on the command line.
18Multiple \f3\-c\f1 arguments may be given.
19The commands are run in the sequence given, then the program exits.
20.TP
21\f3\-p\f1 \f2prog\f1
22Set the program name for prompts and some error messages,
23the default value is \f2xfs_quota\f1.
24.TP
25\f3\-x\f1
26Enable expert mode.
27All of the administrative commands (see the ADMINISTRATOR COMMANDS
28section below) which allow modifications to the quota system are
29available only in expert mode.
30.TP
31\f3\-d\f1 \f2project\f1
32Project names or numeric identifiers may be specified with this option,
33which restricts the output of the individual \f3xfs_quota\f1 commands
34to the set of projects specified.
35Multiple \f3\-d\f1 arguments may be given.
36.PP
37The optional \f2path\f1 argument(s) can be used to specify mount
38points or device files which identify XFS filesystems.
39The output of the individual \f3xfs_quota\f1 commands will then
40be restricted to the set of filesystems specified.
41.PP
42This manual page is divided into two sections \- firstly,
43information for users of filesystems with quota enabled, and the
44.B xfs_quota
45commands of interest to such users; and then information which is
46useful only to administrators of XFS filesystems using quota and the
47quota commands which allow modifications to the quota system.
48.PP
49Note that common to almost all of the individual commands described
50below are the options for specifying which quota types are of interest
51\- user quota (\f2\-u\f1), group quota (\f2\-g\f1), and/or project
52quota (\f2\-p\f1).
53Also, several commands provide options to operate on "blocks used"
54(\f2\-b\f1), "inodes used" (\f2\-i\f1), and/or "realtime blocks used"
55(\f2\-r\f1).
56.PP
57Many commands also have extensive online help.
58Use the \f3help\f1 command for more details on any command.
59.SH QUOTA OVERVIEW
60.PP
61In most computing environments, disk space is not infinite.
62The quota subsystem provides a mechanism to control usage of disk space.
63Quotas can be set for each individual user on any/all of the local
64filesystems.
65The quota subsystem warns users when they exceed their allotted limit,
66but allows some extra space for current work (hard limit/soft limit).
67In addition, XFS filesystems with limit enforcement turned off can be
68used as an effective disk usage accounting system.
69.SS Users' View of Disk Quotas
70To most users, disk quotas are either of no concern or a fact of life
71that cannot be avoided.
72There are two possible quotas that can be imposed \- a limit can be set
73on the amount of space a user can occupy, and there may be a limit on
74the number of files (inodes) he can own.
75.br
76The \f2quota\f1 command provides information on the quotas that have been
77set by the system administrators and current usage.
78.br
79There are four numbers for each limit: current usage, soft limit
80(quota), hard limit, and time limit.
81The soft limit is the number of 1K-blocks (or files) that the user is
82expected to remain below.
83The hard limit cannot be exceeded.
84If a user's usage reaches the hard limit, further requests for space
85(or attempts to create a file) fail with the "Quota exceeded" (EDQUOT)
86error.
87.br
88When a user exceeds the soft limit, the timer is enabled.
89Any time the quota drops below the soft limits, the timer is disabled.
90If the timer pops, the particular limit that has been exceeded is treated
91as if the hard limit has been reached, and no more resources are allocated
92to the user.
93The only way to reset this condition, short of turning off limit
94enforcement or increasing the limit, is to reduce usage below quota.
95Only the superuser (i.e. a sufficiently capable process) can set the
96time limits and this is done on a per filesystem basis.
97.SS Surviving When the Quota Limit Is Reached
98In most cases, the only way for a user to recover from over-quota
99conditions is to abort whatever activity is in progress on the filesystem
100that has reached its limit, remove sufficient files to bring the limit
101back below quota, and retry the failed program.
102.br
103However, if a user is in the editor and a write fails because of an over
104quota situation, that is not a suitable course of action.
105It is most likely that initially attempting to write the file has truncated
106its previous contents, so if the editor is aborted without correctly writing
107the file, not only are the recent changes lost, but possibly much, or even
108all, of the contents that previously existed.
109.br
110There are several possible safe exits for a user caught in this situation.
111He can use the editor shell escape command to examine his file space
112and remove surplus files. Alternatively, using
113.BR sh (1),
114he can suspend
115the editor, remove some files, then resume it.
116A third possibility is to write the file to some other filesystem (perhaps
117to a file on \f2/tmp\f1) where the user's quota has not been exceeded.
118Then after rectifying the quota situation, the file can be moved back to the
119filesystem it belongs on.
120.SH USER COMMANDS
121.TP
122\f3path\f1 [ \f2N\f1 ]
123Lists all paths with devices/project identifiers or set the current
124path to the \f2N\f1th list entry (the current path is used by many
125of the commands described here, it identifies the filesystem toward
126which a command is directed).
127The path list can come from several places \- the command line,
128the mount table, and the \f2/etc/projects\f1 file.
129.TP
130\f3df\f1
131See the \f3free\f1 command.
132.TP
133\f3quota\f1 [ \f2\-gpu\f1 ] [ \f2\-bir\f1 ] [ \f2\-hnNv\f1 ] [ id|name ] ...
134Show individual usage and limits, for a single user name or numeric
135user ID.
136The \f2\-h\f1 option reports in a "human-readable" format similar
137to the
138.BR df (1)
139command.
140.TP
141\f3free\f1 [ \f2\-bir\f1 ] [ \f2\-hN\f1 ]
142Reports filesystem usage, much like the
143.BR df (1)
144utility.
145It can show usage for blocks, inode, and/or realtime block space,
146and shows used, free, and total available.
147If directory quota are in use (see the DIRECTORY QUOTA section below),
148it will also report utilisation for those directory trees.
149The \f2\-h\f1 option reports in a "human-readable" format,
150.TP
151\f3help\f1 [ \f2command\f1]
152Online help for all commands, or one specific \f2command\f1.
153.TP
154\f3quit\f1
155Exit \f2xfs_quota\f1.
156.TP
157\f3q\f1
158See the \f3quit\f1 command.
159.SH QUOTA ADMINISTRATION
160The XFS quota system differs to that of other filesystems
161in a number of ways.
162Most importantly, XFS considers quota information as
163filesystem metadata and uses journaling to provide a higher level
164guarantee of consistency.
165As such, it is administered differently, in particular:
166.TP
1671.
2a1888c5
NS
168The
169.B quotacheck
170command has no effect on XFS filesystems.
42cf2b97
NS
171The first time quota accounting is turned on (at mount time), XFS does
172an automatic quotacheck internally; afterwards, the quota system will
173always be completely consistent until quotas are manually turned off.
174.TP
1752.
176There is no need for quota file(s) in the root of the XFS filesystem.
177.TP
1783.
179XFS distinguishes between quota accounting and limit enforcement.
180Quota accounting must be turned on at the time of mounting the XFS
181filesystem.
182However, it is possible to turn on/off limit enforcement any time
183quota accounting is turned on.
184The "quota" option to the
2a1888c5 185.B mount
42cf2b97
NS
186command turns on both (user) quota accounting and enforcement.
187The "uqnoenforce" option must be used to turn on user accounting with
188limit enforcement disabled.
189.TP
1904.
191Turning on quotas on the root filesystem is slightly different from
192the above.
193For IRIX XFS, refer to
2a1888c5 194.BR quotaon (1M).
42cf2b97
NS
195For Linux XFS, the quota mount flags must be passed in with the
196"rootflags=" boot parameter.
197.TP
1985.
199It is useful to use the \f2state\f1 to monitor the XFS quota subsystem
200at various stages \- it can be used to see if quotas are turned on,
201and also to monitor the space occupied by the quota system itself..
202.TP
2036.
204There is a mechanism built into
2a1888c5 205.B xfsdump
42cf2b97
NS
206that allows quota limit information to be backed up for later
207restoration, should the need arise.
208.TP
2097.
210Quota limits cannot be set before turning on quotas on.
211.TP
2128.
213XFS filesystems keep quota accounting on the superuser (user ID zero),
214and the tool will display the superuser's usage information.
215However, limits are never enforced on the superuser (nor are they
216enforced for group and project ID zero).
217.TP
2189.
219XFS filesystems perform quota accounting whether the user has quota
220limits or not.
221.TP
22210.
223XFS supports the notion of project quota, which can be used to
224implement a form of directory tree quota (i.e. to restrict a
225directory tree to only being able to use up a component of the
226filesystems available space; or simply to keep track of the
227amount of space used, or number of inodes, within the tree).
228.SH ADMINISTRATOR COMMANDS
229.TP
230\f3report\f1 [ \f2\-gpu\f1 ] [ \f2\-bir\f1 ] [ \f2\-ahnNt\f1 ]
231Report filesystem quota information.
232This reports all quota usage for a filesystem, for the specified
233quota type (u/g/p and/or blocks/inodes/realtime).
234It reports blocks in 1KB units by default.
235The \f2\-h\f1 option reports in a "human-readable" format similar
236to the
237.BR df (1)
238command.
239.TP
240\f3state\f1 [ \f2\-gpu\f1 ]
241Report overall quota state information.
242This reports on the state of quota accounting, quota enforcement,
243and the number of extents being used by quota metadata within the
244filesystem.
245.TP
246\f3limit\f1 [ \f2\-gpu\f1 ] \\
247\f2bsoft\f1=N | \f2bhard\f1=N | \f2isoft\f1=N | \f2ihard\f1=N | \f2rtbsoft\f1=N | \f2rtbhard\f1=N... \-d|id|name
248.br
249Set quota block limits (bhard/bsoft), inode count limits (ihard/isoft)
250and/or realtime block limits (rtbhard/rtbsoft).
251The \f2\-d\f1 option (defaults) can be used to set the default value
252that will be used, otherwise a specific user/group/project name or
253numeric identifier must be specified.
254.TP
255\f3timer\f1 [ \f2\-gpu\f1 ] [ \f2\-bir\f1 ] value
256Allows the quota enforcement timeout (i.e. the amount of time allowed
257to pass before the soft limits are enforced as the hard limits) to
258be modified.
259The current timeout setting can be displayed using the \f3state\f1 command.
260The value argument is a number of seconds, but units of 'seconds',
261'minutes', 'hours', 'days', and 'weeks' are also understood
262(as are their abbreviations, 's', 'm', 'h', 'd', and 'w').
263.TP
264\f3warn\f1 [ \f2\-gpu\f1 ] [ \f2\-bir\f1 ] value \-d|id|name
265Allows the quota warnings limit (i.e. the number of times a warning
266will be send to someone over quota) to be viewed and modified.
267The \f2\-d\f1 option (defaults) can be used to set the default time
268that will be used, otherwise a specific user/group/project name or
269numeric identifier must be specified.
270NOTE: this feature is not currently implemented.
271.TP
272\f3enable\f1 [ \f2\-gpu\f1 ] [ \f2\-v\f1 ]
273Switches on quota enforcement for the filesystem identified by the
274current path.
275This requires the filesystem to have been mounted with quota enabled,
276and for accounting to be currently active.
277The \f2\-v\f1 option (verbose) displays the state after the operation
278has completed.
279.TP
280\f3disable\f1 [ \f2\-gpu\f1 ] [ \f2\-v\f1 ]
281Disables quota enforcement, while leaving quota accounting active.
282The \f2\-v\f1 option (verbose) displays the state after the operation
283has completed.
284.TP
285\f3off\f1 [ \f2\-gpu\f1 ] [ \f2\-v\f1 ]
286Permanently switches quota off for the filesystem identified by the
287current path.
288Quota can only be switched back on subsequently by unmounting and
289then mounting again.
290.TP
291\f3remove\f1 [ \f2\-gpu\f1 ] [ \f2\-v\f1 ]
292Remove any space allocated to quota metadata from the filesystem
293identified by the current path.
294Quota must not be enabled on the filesystem, else this operation will
295report an error.
296.TP
297\f3dump\f1 [ \f2\-gpu\f1 ] [ \f2\-f\f1 \f2file\f1 ]
298Dump out quota limit information for backup utilities, either to
299standard output (default) or to a file.
300This is only the limits, not the usage information, of course.
301.TP
302\f3restore\f1 [ \f2\-gpu\f1 ] [ \f2\-f\f1 \f2file\f1 ]
303Restore quota limits from a backup \f2file\f1.
304The file must be in the format produced by the \f3dump\f1 command.
305.TP
306\f3quot\f1 [ \f2\-gpu\f1 ] [ \f2\-bir\f1 ] [ \f2\-av\f1 ] [ \f2\-c\f1 ]
307Summarize filesystem ownership, by user, group or project.
308This command uses a special XFS "bulkstat" interface to quickly scan
309an entire filesystem and report usage information.
310This command can be used even when filesystem quota are not enabled,
311as it is a full-filesystem scan (it may also take a long time...).
312.TP
313\f3project\f1 [ \f2\-cds\f1 id|name ]
314Without arguments, this command lists known project names and identifiers
315(based on entries in the
316.I /etc/projects
317and
318.I /etc/projid
319files).
320The \f2\-c\f1, \f2\-C\f1, and \f2\-s\f1 options allow the directory
321tree quota mechanism, discussed in detail below, to be maintained.
322.SH TREE QUOTA
323The project quota mechanism in XFS can be used to implement a form of
324directory tree quota, where a specified directory and all of the files
325and subdirectories below it (i.e. a tree) can be restricted to using
326a subset of the available space in the filesystem.
327.PP
328A managed tree must be setup initially using the
329\f2\-c\f1 option to the \f3project\f1 command.
330The specified project name or identifier is matched to one or more trees
331defined in
332.IR /etc/projects ,
333and these trees are then recursively descended
334to mark the affected inodes as being part of that tree.
335This process sets an inode flag and the project identifier on every file
336in the affected tree.
337Once this has been done, new files created in the tree will automatically
338be accounted to the tree based on their project identifier.
339An attempt to create a hard link to a file in the tree will only succeed
340if the project identifier matches the project identifier for the tree.
341The
342.B xfs_io
343utility can be used to set the project ID for an arbitrary file, but this
344can only be done by a privileged user.
345.PP
346A previously setup tree can be cleared from project quota control through
347use of the \f3project\f1 \f2\-C\f1 option, which will recursively descend
348the tree, clearing the affected inodes from project quota control.
349.PP
350Finally, the \f3project\f1 \f2\-c\f1 option can be used to check whether a
351tree is setup, it reports nothing if the tree is correct, otherwise it
352reports the paths of inodes which do not have the project ID of the rest
353of the tree, or if the inode flag is not set.
354.SH FILE FORMATS
355There are two files involved with the tree quota mechanism, namely
356.I /etc/projects
357and
358.IR /etc/projid .
359The latter is optional.
360The
361.I projects
362file provides a mapping between numeric project identifiers and those
363directories which are the roots of the quota tree.
364Its format is simply:
365.nf
366.sp .8v
367.in +5
368# comments are hash-prefixed
369# ...
37010:/export/cage
37142:/var/log
372.in -5
373.fi
374.PP
375The
376.I projid
377file provides a mapping between numeric project identifiers and a
378simple human readable name (similar relationship to the one that
379exists between usernames and uids).
380Its format is simply:
381.nf
382.sp .8v
383.in +5
384# comments are hash-prefixed
385# ...
38610:cage
38742:logfiles
388.in -5
389.fi
390.PP
391This file is optional, if a project identifier cannot be mapped to
392a name, it will be displayed as a number only.
393.PP
394.SH EXAMPLES
395Enabling quota enforcement on an XFS filesystem (restrict a user
396to a set amount of space).
397.nf
398.sp .8v
399.in +5
56122696 400# mount \-o uquota /dev/xvm/home /home
3dfde25b 401# xfs_quota \-x \-c 'limit bsoft=500m bhard=550m tanya' /home
56122696 402# xfs_quota \-c report /home
42cf2b97
NS
403.in -5
404.fi
405.PP
406Enabling directory quota on an XFS filesystem (restrict files in
407log file directories to only using 1 gigabyte of space).
408.nf
409.sp .8v
410.in +5
56122696 411# mount \-o pquota /dev/xvm/var /var
42cf2b97
NS
412# echo 42:/var/log >> /etc/projects
413# echo logfiles:42 >> /etc/projid
3dfde25b
NS
414# xfs_quota \-x \-c 'projects \-c logfiles' /home
415# xfs_quota \-x \-c 'limit \-p bhard=1g logfiles' /home
42cf2b97
NS
416.in -5
417.fi
418.SH CAVEATS
419XFS implements delayed allocation (aka. allocate-on-flush) and this
420has implications for the quota subsystem.
421Since quota accounting can only be done when blocks are actually
422allocated, it is possible to issue (buffered) writes into a file
423and not see the usage immediately updated.
424Only when the data is actually written out, either via one of the
425kernels flushing mechanisms, or via a manual
426.BR sync (2),
427will the usage reported reflect what has actually been written.
428.PP
429In addition, the XFS allocation mechanism will always reserve the
430maximum amount of space required before proceeding with an allocation.
431If insufficient space for this reservation is available, due to the
432block quota limit being reached for example, this may result in the
433allocation failing even though there is sufficient space.
434Quota enforcement can thus sometimes happen in situations where the
435user is under quota and the end result of some operation would still
436have left the user under quota had the operation been allowed to run
437its course.
438This additional overhead is typically in the range of tens of blocks.
439.PP
440Both of these properties are unavoidable side effects of the way XFS
441operates, so should be kept in mind when assigning block limits.
442.SH BUGS
443Quota support for filesystems with realtime subvolumes is not yet
444implemented, nor is the quota warning mechanism (the Linux
445.BR warnquota (8)
446tool can be used to provide similar functionality on that platform).
447.SH FILES
448.PD 0
449.TP 20
450.BR /etc/projects
451Mapping of numeric project identifiers to directories trees.
452.TP
453.BR /etc/projid
454Mapping of numeric project identifiers to project names.
455.PD
2a1888c5
NS
456.SH IRIX SEE ALSO
457quotaon(1M),
458xfs(4).
459
460.SH LINUX SEE ALSO
461warnquota(8),
462xfs(5).
463
42cf2b97
NS
464.SH SEE ALSO
465df(1),
466mount(1),
467sync(2),