]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - man/man8/xfs_quota.8
xfsprogs: remove irix platform files
[thirdparty/xfsprogs-dev.git] / man / man8 / xfs_quota.8
1 .TH xfs_quota 8
2 .SH NAME
3 xfs_quota \- manage use of quota on XFS filesystems
4 .SH SYNOPSIS
5 .B xfs_quota
6 [
7 .B \-x
8 ] [
9 .B \-f
10 ] [
11 .B \-p
12 .I prog
13 ] [
14 .B \-c
15 .I cmd
16 ] ... [
17 .B \-d
18 .I project
19 ] ... [
20 .B \-D
21 .I projects_file
22 ] [
23 .B \-P
24 .I projid_file
25 ] [
26 .IR path " ... ]"
27 .br
28 .B xfs_quota \-V
29 .SH DESCRIPTION
30 .B xfs_quota
31 is a utility for reporting and editing various aspects of filesystem quota.
32 .PP
33 The options to
34 .B xfs_quota
35 are:
36 .TP 1.0i
37 .BI \-c " cmd"
38 .B xfs_quota
39 commands may be run interactively (the default) or as arguments on
40 the command line. Multiple
41 .B \-c
42 arguments may be given.
43 The commands are run in the sequence given, then the program exits.
44 .TP
45 .BI \-p " prog"
46 Set the program name for prompts and some error messages,
47 the default value is
48 .BR xfs_quota .
49 .TP
50 .B \-x
51 Enable expert mode.
52 All of the administrative commands (see the ADMINISTRATOR COMMANDS
53 section below) which allow modifications to the quota system are
54 available only in expert mode.
55 .TP
56 .B \-f
57 Enable foreign filesystem mode.
58 A limited number of user and administrative commands are available for
59 use on some foreign (non-XFS) filesystems.
60 .TP
61 .BI \-d " project"
62 Project names or numeric identifiers may be specified with this option,
63 which restricts the output of the individual
64 .B xfs_quota
65 commands to the set of projects specified. Multiple
66 .B \-d
67 arguments may be given.
68 .TP
69 .BI \-D " projects_file"
70 Specify a file containing the mapping of numeric project identifiers
71 to directory trees.
72 .I /etc/projects
73 as default, if this option is none.
74 .TP
75 .BI \-P " projid_file"
76 Specify a file containing the mapping of numeric project identifiers
77 to project names.
78 .I /etc/projid
79 as default, if this option is none.
80 .TP
81 .B \-V
82 Prints the version number and exits.
83 .PP
84 The optional
85 .I path
86 argument(s) can be used to specify mount points or device files
87 which identify XFS filesystems. The output of the individual
88 .B xfs_quota
89 commands will then be restricted to the set of filesystems specified.
90 .PP
91 This manual page is divided into two sections \- firstly,
92 information for users of filesystems with quota enabled, and the
93 .B xfs_quota
94 commands of interest to such users; and then information which is
95 useful only to administrators of XFS filesystems using quota and the
96 quota commands which allow modifications to the quota system.
97 .PP
98 Note that common to almost all of the individual commands described
99 below are the options for specifying which quota types are of interest
100 \- user quota
101 .RB ( \-u ),
102 group quota
103 .RB ( \-g ),
104 and/or project quota
105 .RB ( \-p ).
106 Also, several commands provide options to operate on "blocks used"
107 .RB ( \-b ),
108 "inodes used"
109 .RB ( \-i ),
110 and/or "realtime blocks used"
111 .RB ( \-r ).
112 .PP
113 Many commands also have extensive online help. Use the
114 .B help
115 command for more details on any command.
116 .SH QUOTA OVERVIEW
117 .PP
118 In most computing environments, disk space is not infinite.
119 The quota subsystem provides a mechanism to control usage of disk space.
120 Quotas can be set for each individual user on any/all of the local
121 filesystems.
122 The quota subsystem warns users when they exceed their allotted limit,
123 but allows some extra space for current work (hard limit/soft limit).
124 In addition, XFS filesystems with limit enforcement turned off can be
125 used as an effective disk usage accounting system.
126 .SS Users' View of Disk Quotas
127 To most users, disk quotas are either of no concern or a fact of life
128 that cannot be avoided.
129 There are two possible quotas that can be imposed \- a limit can be set
130 on the amount of space a user can occupy, and there may be a limit on
131 the number of files (inodes) he can own.
132 .PP
133 The
134 .B quota
135 command provides information on the quotas that have been
136 set by the system administrators and current usage.
137 .PP
138 There are four numbers for each limit: current usage, soft limit
139 (quota), hard limit, and time limit.
140 The soft limit is the number of 1K-blocks (or files) that the user is
141 expected to remain below.
142 The hard limit cannot be exceeded.
143 If a user's usage reaches the hard limit, further requests for space
144 (or attempts to create a file) fail with the "Quota exceeded" (EDQUOT)
145 error.
146 .PP
147 When a user exceeds the soft limit, the timer is enabled.
148 Any time the quota drops below the soft limits, the timer is disabled.
149 If the timer pops, the particular limit that has been exceeded is treated
150 as if the hard limit has been reached, and no more resources are allocated
151 to the user.
152 The only way to reset this condition, short of turning off limit
153 enforcement or increasing the limit, is to reduce usage below quota.
154 Only the superuser (i.e. a sufficiently capable process) can set the
155 time limits and this is done on a per filesystem basis.
156 .SS Surviving When the Quota Limit Is Reached
157 In most cases, the only way for a user to recover from over-quota
158 conditions is to abort whatever activity is in progress on the filesystem
159 that has reached its limit, remove sufficient files to bring the limit
160 back below quota, and retry the failed program.
161 .br
162 However, if a user is in the editor and a write fails because of an over
163 quota situation, that is not a suitable course of action.
164 It is most likely that initially attempting to write the file has truncated
165 its previous contents, so if the editor is aborted without correctly writing
166 the file, not only are the recent changes lost, but possibly much, or even
167 all, of the contents that previously existed.
168 .br
169 There are several possible safe exits for a user caught in this situation.
170 He can use the editor shell escape command to examine his file space
171 and remove surplus files. Alternatively, using
172 .BR sh (1),
173 he can suspend
174 the editor, remove some files, then resume it.
175 A third possibility is to write the file to some other filesystem (perhaps
176 to a file on
177 .IR /tmp )
178 where the user's quota has not been exceeded.
179 Then after rectifying the quota situation, the file can be moved back to the
180 filesystem it belongs on.
181 .SH USER COMMANDS
182 .TP
183 .B print
184 Lists all paths with devices/project identifiers.
185 The path list can come from several places \- the command line,
186 the mount table, and the
187 .I /etc/projects
188 file.
189 .TP
190 .B df
191 See the
192 .B free
193 command.
194 .HP
195 .B quota
196 [
197 .BR \-g " | " \-p " | " \-u
198 ] [
199 .B \-bir
200 ] [
201 .B \-hnNv
202 ] [
203 .B \-f
204 .I file
205 ] [
206 .I ID
207 |
208 .I name
209 ] ...
210 .br
211 Show individual usage and limits, for a single user
212 .I name
213 or numeric user
214 .IR ID .
215 The
216 .B \-h
217 option reports in a "human-readable" format similar to the
218 .BR df (1)
219 command. The
220 .B \-n
221 option reports the numeric IDs rather than the name. The
222 .B \-N
223 option omits the header. The
224 .B \-v
225 option outputs verbose information. The
226 .B \-f
227 option sends the output to
228 .I file
229 instead of stdout.
230 .HP
231 .B
232 free
233 [
234 .B \-bir
235 ] [
236 .B \-hN
237 ] [
238 .B \-f
239 .I file
240 ]
241 .br
242 Reports filesystem usage, much like the
243 .BR df (1)
244 utility.
245 It can show usage for
246 .BR b locks,
247 .BR i node,
248 and/or
249 .BR r ealtime
250 block space, and shows used, free, and total available.
251 If project quota are in use (see the DIRECTORY TREE QUOTA section below),
252 it will also report utilisation for those projects (directory trees). The
253 .B \-h
254 option reports in a "human-readable" format. The
255 .B \-N
256 option omits the header. The
257 .B \-f
258 option outputs the report to
259 .I file
260 instead of stdout.
261 .HP
262 .B help
263 [
264 .I command
265 ]
266 .br
267 Online help for all commands, or one specific
268 .IR command .
269 .TP
270 .B quit
271 Exit
272 .BR xfs_quota .
273 .TP
274 .B q
275 See the
276 .B quit
277 command.
278 .SH QUOTA ADMINISTRATION
279 The XFS quota system differs to that of other filesystems
280 in a number of ways.
281 Most importantly, XFS considers quota information as
282 filesystem metadata and uses journaling to provide a higher level
283 guarantee of consistency.
284 As such, it is administered differently, in particular:
285 .IP 1.
286 The
287 .B quotacheck
288 command has no effect on XFS filesystems.
289 The first time quota accounting is turned on (at mount time), XFS does
290 an automatic quotacheck internally; afterwards, the quota system will
291 always be completely consistent until quotas are manually turned off.
292 .IP 2.
293 There is no need for quota file(s) in the root of the XFS filesystem.
294 .IP 3.
295 XFS distinguishes between quota accounting and limit enforcement.
296 Quota accounting must be turned on at the time of mounting the XFS
297 filesystem.
298 However, it is possible to turn on/off limit enforcement any time
299 quota accounting is turned on.
300 The "quota" option to the
301 .B mount
302 command turns on both (user) quota accounting and enforcement.
303 The "uqnoenforce" option must be used to turn on user accounting with
304 limit enforcement disabled.
305 .IP 4.
306 Turning on quotas on the root filesystem is slightly different from
307 the above.
308 For Linux XFS, the quota mount flags must be passed in with the
309 "rootflags=" boot parameter.
310 .IP 5.
311 It is useful to use the
312 .B state
313 to monitor the XFS quota subsystem
314 at various stages \- it can be used to see if quotas are turned on,
315 and also to monitor the space occupied by the quota system itself..
316 .IP 6.
317 There is a mechanism built into
318 .B xfsdump
319 that allows quota limit information to be backed up for later
320 restoration, should the need arise.
321 .IP 7.
322 Quota limits cannot be set before turning on quotas on.
323 .IP 8.
324 XFS filesystems keep quota accounting on the superuser (user ID zero),
325 and the tool will display the superuser's usage information.
326 However, limits are never enforced on the superuser (nor are they
327 enforced for group and project ID zero).
328 .IP 9.
329 XFS filesystems perform quota accounting whether the user has quota
330 limits or not.
331 .IP 10.
332 XFS supports the notion of project quota, which can be used to
333 implement a form of directory tree quota (i.e. to restrict a
334 directory tree to only being able to use up a component of the
335 filesystems available space; or simply to keep track of the
336 amount of space used, or number of inodes, within the tree).
337 .SH ADMINISTRATOR COMMANDS
338 .HP
339 .B path
340 [
341 .I N
342 ]
343 .br
344 Lists all paths with devices/project identifiers or set the current
345 path to the
346 .IR N th
347 list entry (the current path is used by many
348 of the commands described here, it identifies the filesystem toward
349 which a command is directed).
350 The path list can come from several places \- the command line,
351 the mount table, and the
352 .I /etc/projects
353 file.
354 .HP
355 .B report
356 [
357 .B \-gpu
358 ] [
359 .B \-bir
360 ] [
361 .B \-ahntlLNU
362 ] [
363 .B \-f
364 .I file
365 ]
366 .br
367 Report filesystem quota information.
368 This reports all quota usage for a filesystem, for the specified
369 quota type
370 .RB ( u / g / p
371 and/or
372 .BR b locks/ i nodes/ r ealtime).
373 It reports blocks in 1KB units by default. The
374 .B \-h
375 option reports in a "human-readable" format similar to the
376 .BR df (1)
377 command. The
378 .B \-f
379 option outputs the report to
380 .I file
381 instead of stdout. The
382 .B \-a
383 option reports on all filesystems. By default, outputs the name of
384 the user/group/project. If no name is defined for a given ID, outputs
385 the numeric ID instead. The
386 .B \-n
387 option outputs the numeric ID instead of the name. The
388 .B \-L
389 and
390 .B \-U
391 options specify lower and upper ID bounds to report on. If upper/lower
392 bounds are specified, then by default only the IDs will be displayed
393 in output; with the
394 .B \-l
395 option, a lookup will be performed to translate these IDs to names. The
396 .B \-N
397 option reports information without the header line. The
398 .B \-t
399 option performs a terse report.
400 .HP
401 .B
402 state
403 [
404 .B \-gpu
405 ] [
406 .B \-av
407 ] [
408 .B \-f
409 .I file
410 ]
411 .br
412 Report overall quota state information.
413 This reports on the state of quota accounting, quota enforcement,
414 and the number of extents being used by quota metadata within the
415 filesystem. The
416 .B \-f
417 option outputs state information to
418 .I file
419 instead of stdout. The
420 .B \-a
421 option reports state on all filesystems and not just the current path.
422 .HP
423 .B
424 limit
425 [
426 .BR \-g " | " \-p " | " \-u
427 ]
428 .BI bsoft= N
429 |
430 .BI bhard= N
431 |
432 .BI isoft= N
433 |
434 .BI ihard= N
435 |
436 .BI rtbsoft= N
437 |
438 .BI rtbhard= N
439 .B \-d
440 |
441 .I id
442 |
443 .I name
444 .br
445 Set quota block limits (bhard/bsoft), inode count limits (ihard/isoft)
446 and/or realtime block limits (rtbhard/rtbsoft). The
447 .B \-d
448 option (defaults) can be used to set the default value
449 that will be used, otherwise a specific
450 .BR u ser/ g roup/ p roject
451 .I name
452 or numeric
453 .IR id entifier
454 must be specified.
455 .HP
456 .B timer
457 [
458 .BR \-g " | " \-p " | " \-u
459 ] [
460 .B \-bir
461 ]
462 .I value
463 .br
464 Allows the quota enforcement timeout (i.e. the amount of time allowed
465 to pass before the soft limits are enforced as the hard limits) to
466 be modified. The current timeout setting can be displayed using the
467 .B state
468 command. The value argument is a number of seconds, but units of
469 \&'minutes', 'hours', 'days', and 'weeks' are also understood
470 (as are their abbreviations 'm', 'h', 'd', and 'w').
471 .HP
472 .B warn
473 [
474 .BR \-g " | " \-p " | " \-u
475 ] [
476 .B \-bir
477 ]
478 .I value
479 .B -d
480 |
481 .I id
482 |
483 .I name
484 .br
485 Allows the quota warnings limit (i.e. the number of times a warning
486 will be send to someone over quota) to be viewed and modified. The
487 .B \-d
488 option (defaults) can be used to set the default time
489 that will be used, otherwise a specific
490 .BR u ser/ g roup/ p roject
491 .I name
492 or numeric
493 .IR id entifier
494 must be specified.
495 .B NOTE: this feature is not currently implemented.
496 .TP
497 .BR enable " [ " \-gpu " ] [ " \-v " ]"
498 Switches on quota enforcement for the filesystem identified by the
499 current path.
500 This requires the filesystem to have been mounted with quota enabled,
501 and for accounting to be currently active. The
502 .B \-v
503 option (verbose) displays the state after the operation has completed.
504 .TP
505 .BR disable " [ " \-gpu " ] [ " \-v " ]"
506 Disables quota enforcement, while leaving quota accounting active. The
507 .B \-v
508 option (verbose) displays the state after the operation has completed.
509 .TP
510 .BR off " [ " \-gpu " ] [ " \-v " ]"
511 Permanently switches quota off for the filesystem identified by the
512 current path.
513 Quota can only be switched back on subsequently by unmounting and
514 then mounting again.
515 .TP
516 .BR remove " [ " \-gpu " ] [ " \-v " ]"
517 Remove any space allocated to quota metadata from the filesystem
518 identified by the current path.
519 Quota must not be enabled on the filesystem, else this operation will
520 report an error.
521 .HP
522 .B
523 dump
524 [
525 .BR \-g " | " \-p " | " \-u
526 ] [
527 .B \-f
528 .I file
529 ]
530 .br
531 Dump out quota limit information for backup utilities, either to
532 standard output (default) or to a
533 .IR file .
534 This is only the limits, not the usage information, of course.
535 .HP
536 .B restore
537 [
538 .BR \-g " | " \-p " | " \-u
539 ] [
540 .B \-f
541 .I file
542 ]
543 .br
544 Restore quota limits from a backup
545 .IR file .
546 The file must be in the format produced by the
547 .B dump
548 command.
549 .HP
550 .B
551 quot
552 [
553 .BR \-g " | " \-p " | " \-u
554 ] [
555 .B \-bir
556 ] [
557 .B \-acnv
558 ] [
559 .B \-f
560 .I file
561 ]
562 .br
563 Summarize filesystem ownership, by user, group or project.
564 This command uses a special XFS "bulkstat" interface to quickly scan
565 an entire filesystem and report usage information.
566 This command can be used even when filesystem quota are not enabled,
567 as it is a full-filesystem scan (it may also take a long time...). The
568 .B \-a
569 option displays information on all filesystems. The
570 .B \-c
571 option displays a histogram instead of a report. The
572 .B \-n
573 option displays numeric IDs rather than names. The
574 .B \-v
575 option displays verbose information. The
576 .B \-f
577 option send the output to
578 .I file
579 instead of stdout.
580 .HP
581 .B project
582 [
583 .B \-cCs
584 [
585 .B \-d
586 .I depth
587 ]
588 [
589 .B \-p
590 .I path
591 ]
592 .I id
593 |
594 .I name
595 ]
596 .br
597 The
598 .BR \-c ,
599 .BR \-C ,
600 and
601 .B \-s
602 options allow the directory tree quota mechanism to be maintained.
603 .BR \-d
604 allows one to limit recursion level when processing project directories
605 and
606 .BR \-p
607 allows one to specify project paths at command line ( instead of
608 .I /etc/projects
609 ). All options are discussed in detail below.
610 .SH DIRECTORY TREE QUOTA
611 The project quota mechanism in XFS can be used to implement a form of
612 directory tree quota, where a specified directory and all of the files
613 and subdirectories below it (i.e. a tree) can be restricted to using
614 a subset of the available space in the filesystem.
615 .PP
616 A managed tree must be setup initially using the
617 .B \-s
618 option to the
619 .B project
620 command. The specified project name or identifier is matched to one
621 or more trees defined in
622 .IR /etc/projects ,
623 and these trees are then recursively descended
624 to mark the affected inodes as being part of that tree.
625 This process sets an inode flag and the project identifier on every file
626 in the affected tree.
627 Once this has been done, new files created in the tree will automatically
628 be accounted to the tree based on their project identifier.
629 An attempt to create a hard link to a file in the tree will only succeed
630 if the project identifier matches the project identifier for the tree.
631 The
632 .B xfs_io
633 utility can be used to set the project ID for an arbitrary file, but this
634 can only be done by a privileged user.
635 .PP
636 A previously setup tree can be cleared from project quota control through
637 use of the
638 .B project \-C
639 option, which will recursively descend
640 the tree, clearing the affected inodes from project quota control.
641 .PP
642 Finally, the
643 .B project \-c
644 option can be used to check whether a
645 tree is setup, it reports nothing if the tree is correct, otherwise it
646 reports the paths of inodes which do not have the project ID of the rest
647 of the tree, or if the inode flag is not set.
648 .PP
649 Option
650 .B \-d
651 can be used to limit recursion level (\-1 is infinite, 0 is top level only,
652 1 is first level ... ).
653 Option
654 .B \-p
655 adds possibility to specify project paths in command line without a need
656 for
657 .I /etc/projects
658 to exist. Note that if projects file exists then it is also used.
659
660 .SH EXAMPLES
661 Enabling quota enforcement on an XFS filesystem (restrict a user
662 to a set amount of space).
663 .nf
664 .sp
665 .in +5
666 # mount \-o uquota /dev/xvm/home /home
667 # xfs_quota \-x \-c 'limit bsoft=500m bhard=550m tanya' /home
668 # xfs_quota \-x \-c report /home
669 .in -5
670 .fi
671 .PP
672 Enabling project quota on an XFS filesystem (restrict files in
673 log file directories to only using 1 gigabyte of space).
674 .nf
675 .sp
676 .in +5
677 # mount \-o prjquota /dev/xvm/var /var
678 # echo 42:/var/log >> /etc/projects
679 # echo logfiles:42 >> /etc/projid
680 # xfs_quota \-x \-c 'project \-s logfiles' /var
681 # xfs_quota \-x \-c 'limit \-p bhard=1g logfiles' /var
682 .in -5
683 .fi
684 .PP
685 Same as above without a need for configuration files.
686 .nf
687 .sp
688 .in +5
689 # rm \-f /etc/projects /etc/projid
690 # mount \-o prjquota /dev/xvm/var /var
691 # xfs_quota \-x \-c 'project \-s \-p /var/log 42' /var
692 # xfs_quota \-x \-c 'limit \-p bhard=1g 42' /var
693 .in -5
694 .fi
695 .SH CAVEATS
696 XFS implements delayed allocation (aka. allocate-on-flush) and this
697 has implications for the quota subsystem.
698 Since quota accounting can only be done when blocks are actually
699 allocated, it is possible to issue (buffered) writes into a file
700 and not see the usage immediately updated.
701 Only when the data is actually written out, either via one of the
702 kernels flushing mechanisms, or via a manual
703 .BR sync (2),
704 will the usage reported reflect what has actually been written.
705 .PP
706 In addition, the XFS allocation mechanism will always reserve the
707 maximum amount of space required before proceeding with an allocation.
708 If insufficient space for this reservation is available, due to the
709 block quota limit being reached for example, this may result in the
710 allocation failing even though there is sufficient space.
711 Quota enforcement can thus sometimes happen in situations where the
712 user is under quota and the end result of some operation would still
713 have left the user under quota had the operation been allowed to run
714 its course.
715 This additional overhead is typically in the range of tens of blocks.
716 .PP
717 Both of these properties are unavoidable side effects of the way XFS
718 operates, so should be kept in mind when assigning block limits.
719 .SH BUGS
720 Quota support for filesystems with realtime subvolumes is not yet
721 implemented, nor is the quota warning mechanism (the Linux
722 .BR warnquota (8)
723 tool can be used to provide similar functionality on that platform).
724 .SH FILES
725 .PD 0
726 .TP 20
727 .I /etc/projects
728 Mapping of numeric project identifiers to directories trees.
729 .TP
730 .I /etc/projid
731 Mapping of numeric project identifiers to project names.
732 .PD
733
734 .SH SEE ALSO
735 .BR df (1),
736 .BR mount (1),
737 .BR sync (2),
738 .BR projid (5),
739 .BR projects (5).
740 .BR xfs (5).
741 .BR warnquota (8),