xfs_quota(8)
π NAME π
Hiii bestie, this is the xfs_quota(8) page, and it's all about managing quota on XFS filesystems π
xfs_quota β manage use of quota on XFS filesystems β¨
π¦ SYNOPSIS π¦
xfs_quota [ -x ] [ -f ] [ -p prog ] [ -c cmd ] ... [ -d project ] ... [
-D projects_file ] [ -P projid_file ] [ path ... ]
xfs_quota -V
πΈ DESCRIPTION πΈ
okay so xfs_quota is a utility for reporting and editing all sorts of stuff about filesystem quota π
The options to xfs_quota are:
-c cmdβ you can runxfs_quotacommands interactively (that's the default) or pass them as arguments on the command line. You can give several-carguments, and they run in the order you wrote them, then the program exits π-p progβ sets the program name used in prompts and some error messages. If you don't pick one, it'sxfs_quotaπ§-xβ turns on expert mode π All of the administrative commands (see the ADMINISTRATOR COMMANDS section below) that let you modify the quota system are only available in expert mode, so don't go poking around without it π-fβ turns on foreign filesystem mode. A small handful of user and administrative commands work on some non-XFS filesystems π«Ά-d projectβ project names or numeric IDs go here, and they limit the output of the individualxfs_quotacommands to just the projects you specify. You can give multiple-darguments π-D projects_fileβ points to a file that maps numeric project IDs to directory trees. If you don't set this option, it defaults to/etc/projectsπ-P projid_fileβ points to a file that maps numeric project IDs to project names. If you don't set this option, it defaults to/etc/projidβ-Vβ prints the version number and exits. Quick and easy β¨
The optional path argument(s) can be used to point at mount points or device files that identify XFS filesystems. The output of the individual xfs_quota commands will then be limited to just the filesystems you name π¦
This manual page is split into two sections. First up is info for users of filesystems with quota enabled, plus the xfs_quota commands that matter to them. Then comes the stuff that's only useful to administrators of XFS filesystems using quota, including the quota commands that let you change the quota system π
Heads up: almost every individual command below shares the options for choosing which quota types you care about. That's user quota (-u), group quota (-g), and/or project quota (-p). Several commands also let you work on "blocks used" (-b), "inodes used" (-i), and/or "realtime blocks used" (-r) π
Lots of commands also come with extensive online help. Use the help command for more details on any command π
π QUOTA OVERVIEW π
Okay, real talk: in most computing environments, disk space is not infinite π The quota subsystem is the thing that keeps usage in check. Quotas can be set for each individual user on any or all of the local filesystems. The quota subsystem warns users when they go over their allotted limit, but it gives them a little extra room for current work (hard limit/soft limit). Also, XFS filesystems with limit enforcement turned off can double as an effective disk usage accounting system π§Ύ
π₯Ί Users' View of Disk Quotas
To most users, disk quotas are either no concern at all or just a fact of life that can't be avoided π Two kinds of quota can be imposed: a limit on how much space a user can occupy, and possibly a limit on how many files (inodes) they can own.
The quota command shows the quotas the system administrators have set, along with current usage β¨
Every limit has four numbers: current usage, soft limit (quota), hard limit, and time limit. The soft limit is the number of 1K-blocks (or files) the user is expected to stay below. The hard limit can never be exceeded. If a user hits the hard limit, any further requests for space (or attempts to create a file) fail with the "Quota exceeded" (EDQUOT) error π«
When a user goes over the soft limit, the timer starts. Any time the quota drops back below the soft limit, the timer turns off. If the timer pops, the limit that was exceeded gets treated as if the hard limit was reached, and no more resources get allocated to that user. The only ways to reset this condition are to turn off limit enforcement, increase the limit, or get usage back below quota. Only the superuser (that is, a sufficiently capable process) can set the time limits, and this is done on a per filesystem basis π°οΈ
π Surviving When the Quota Limit Is Reached
In most cases, the only way for a user to recover from an over-quota situation is to abort whatever activity is running on the filesystem that hit its limit, remove enough files to get back below quota, and retry the failed program πββοΈ
Careful with the editor! If a user is in an editor and a write fails because of an over-quota situation, that is NOT a suitable course of action. Initially attempting to write the file has most likely already 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 existed before π±
There are a few safe exits for someone stuck in this situation. They can use the editor's shell escape command to examine their file space and remove surplus files. Alternatively, using sh(1), they can suspend the editor, remove some files, then resume it. A third option is to write the file to some other filesystem (maybe a file on /tmp) where the user's quota hasn't been exceeded. Then, after fixing the quota situation, the file can be moved back to the filesystem it belongs on π«Ά
π Default Quotas
The XFS quota subsystem can enforce a default quota for any user, group or project that doesn't have a quota limit explicitly set. These limits are stored in and displayed as ID 0's limits, even though they don't actually limit ID 0 π
π USER COMMANDS π
These are the commands regular users get to play with πΈ
printβ lists all paths with devices/project identifiers. The path list can come from several places: the command line, the mount table, and the/etc/projectsfile πdfβ see thefreecommand πquota [ -g | -p | -u ] [ -bir ] [ -hnNv ] [ -f file ] [ ID | name ] ...β shows individual usage and limits for a single user name or numeric user ID. The-hoption reports in a "human-readable" format, similar to thedf(1)command. The-noption reports numeric IDs instead of names. The-Noption leaves off the header. The-voption outputs verbose information. The-foption sends the output to a file instead of stdout πfree [ -bir ] [ -hN ] [ -f file ]β reports filesystem usage, kinda like thedf(1)utility. It can show usage for blocks, inodes, and/or realtime block space, and it shows used, free, and total available. If project quota is in use (see the DIRECTORY TREE QUOTA section below), it also reports utilisation for those projects (directory trees). The-hoption gives you a "human-readable" format. The-Noption omits the header. The-foption writes the report to a file instead of stdout πhelp [ command ]β online help for all commands, or for one specific command π§quitβ exitsxfs_quotaπqβ see thequitcommand π
π QUOTA ADMINISTRATION π
Okay, admins, listen up. The XFS quota system is different from other filesystems in a bunch of ways. The biggest one is that XFS treats quota information as filesystem metadata and uses journaling to give a higher-level guarantee of consistency. Because of that, it gets administered differently. Specifically:
- The
quotacheckcommand has no effect on XFS filesystems. The first time quota accounting gets turned on (at mount time), XFS does an automatic quotacheck internally. After that, the quota system stays completely consistent until quotas are manually turned off π€ - There's no need for quota file(s) in the root of the XFS filesystem π ββοΈ
- XFS keeps quota accounting and limit enforcement separate. Quota accounting has to be turned on when the XFS filesystem is mounted. However, you can turn limit enforcement on or off any time quota accounting is on. The
quotaoption to themountcommand turns on both (user) quota accounting and enforcement. To turn on user accounting with limit enforcement disabled, you have to use theuqnoenforceoption π - Turning on quotas on the root filesystem is a little different from the above. For Linux XFS, the quota mount flags must be passed in with the
rootflags=boot parameter π§ - It's useful to use the state to monitor the XFS quota subsystem at various stages. It can show whether quotas are turned on, and it can also monitor the space occupied by the quota system itself.. π
- There's a mechanism built into
xfsdumpthat lets quota limit information get backed up for later restoration, should the need ever arise πΎ - Quota limits can't be set before quotas are turned on π«
- XFS filesystems keep quota accounting on the superuser (user ID zero), and the tool will display the superuser's usage information. However, limits are never enforced on the superuser (nor on group and project ID zero) π
- XFS filesystems perform quota accounting whether or not the user has quota limits π
- XFS supports project quota, which can be used to implement a form of directory tree quota. That means you can restrict a directory tree to only using up a portion of the filesystem's available space, or simply keep track of how much space, or how many inodes, the tree uses π³
β¨ ADMINISTRATOR COMMANDS β¨
okay so these are the admin-only commands π they basically control the whole quota system, so be careful with them bestie π«Ά
path [ N ]πΊοΈ β lists every path that has a device or project identifier, or sets the current path to the Nth list entry. The current path is what most of the commands below use to decide which filesystem they're talking to. The list can come from a few places: the command line, the mount table, and the/etc/projectsfile.report [ -gpu ] [ -bir ] [ -ahntlLNU ] [ -f file ]π β reports filesystem quota info for the filesystem you're on. It shows all the quota usage, filtered by the type you pick (u/g/pand/or blocks/inodes/realtime). Blocks show up in 1KB units unless you say otherwise. The-hoption switches to a human-readable format, similar todf(1). The-foption sends the report to a file instead of stdout, and-areports on all filesystems. By default you get the user, group or project name, but if an ID doesn't have a name it falls back to the numeric one.-nforces numeric IDs.-Land-Uset lower and/or upper ID bounds. When you use bounds, you only see IDs by default, so add-lif you want those IDs looked up and turned into names.-Ndrops the header line, and-tgives you a terse report.state [ -gpu ] [ -av ] [ -f file ]π β reports the overall quota state: whether accounting and enforcement are on, and how many extents the quota metadata is using on the filesystem.-fsends it to a file instead of stdout, and-achecks every filesystem, not just the current path. The current timeout setting also shows up here.limit [ -g | -p | -u ] bsoft=N | bhard=N | isoft=N | ihard=N | rtbsoft=N | rtbhard=N -d | id | nameπ§ β sets the block limits (bhard/bsoft), inode count limits (ihard/isoft) and/or realtime block limits (rtbhard/rtbsoft) toN.Nis a number of bytes or inodes. For block limits you can also use ans/b/k/m/g/t/p/esuffix, the same waymkfs.xfs(8)does it. Inode limits are plain numbers, no suffixes. The-doption sets the default that gets used when nothing more specific is set. Otherwise you have to name a specific user, group or project, or give its numeric ID.timer [ -g | -p | -u ] [ -bir ] value [ -d | id | name ]β° β changes the enforcement timeout, which is how long soft limits can be exceeded before they get enforced as hard limits. You can see the current timeout with thestatecommand. When you set the default timer with-d, or for ID0, or if there's no argument aftervalue,valueis a number of seconds counted from when the soft limit gets exceeded, before the hard limit kicks in. For any other individual timer, set by ID or name,valueis the number of seconds from now when the hard limits will be enforced. This is how you give a specific user who's gone over their soft limit some extra grace time π₯Ή Forvalue,minutes,hours,days, andweeksare understood too, plus their short formsm,h,d, andw.warn [ -g | -p | -u ] [ -bir ] value -d | id | nameπ β is supposed to let you view and change the warning limit, which is how many times someone over quota gets warned. The-doption sets the default time, otherwise you name a user, group or project, or give a numeric ID. > NOTE: this feature is not currently implemented. so it's a vibe for later bestie, not something that works right now πenable [ -gpu ] [ -v ]β β turns quota enforcement on for the filesystem you're on. This needs the filesystem to be mounted with quota enabled, and accounting has to be active right now.-v(verbose) shows the state once it's done.disable [ -gpu ] [ -v ]π« β turns enforcement off but leaves accounting running.-v(verbose) shows the state once it's done.off [ -gpu ] [ -v ]π β permanently switches quota off for the filesystem you're on. The only way to turn it back on is to unmount and then mount the filesystem again.remove [ -gpu ] [ -v ]π§Ή β removes any space that's been allocated to quota metadata on the filesystem you're on. Quota has to be off first though, or this errors out π¬dump [ -g | -p | -u ] [ -L | -U ] [ -f file ]πΎ β dumps the quota limit info for backup tools, either to stdout (the default) or to a file.-Land-Uset lower and/or upper ID bounds. It's only the limits, not the usage info, obviously.restore [ -g | -p | -u ] [ -f file ]β»οΈ β restores quota limits from a backup file. The file has to be in the format that thedumpcommand makes.quot [ -g | -p | -u ] [ -bir ] [ -acnv ] [ -f file ]π₯§ β summarises who owns what on the filesystem, by user, group or project. It uses a special XFS "bulkstat" interface to scan the whole filesystem quickly. This works even when filesystem quota isn't enabled, since it's a full-filesystem scan, so yeah it can take a long time π’-acovers all filesystems,-cgives a histogram instead of a report,-nshows numeric IDs instead of names,-vmakes it verbose, and-fsends the output to a file instead of stdout.project [ -cCs [ -d depth ] [ -p path ] id | name ]π³ β the-c,-Cand-soptions keep the directory tree quota mechanism running.-dlimits how deep the recursion goes when processing project directories, and-plets you give project paths on the command line instead of using/etc/projects. All of this gets explained in detail below.
π³ DIRECTORY TREE QUOTA π³
okay this part is so cool π the project quota mechanism in XFS can be used as a kind of directory tree quota. You pick a directory, and it plus everything inside it (files, subdirectories, the whole tree) gets limited to a slice of the space on the filesystem π«§
You have to set up a managed tree first, using the -s option with the project command. The project name or ID you give gets matched to one or more trees defined in /etc/projects, and those trees get walked recursively so every affected inode gets marked as part of the tree. This sets an inode flag and the project ID on every file in the tree. After that, any new file made in the tree is automatically counted against the tree, based on its project ID. A hard link to a file in the tree will only work if the project ID matches the tree's project ID π The xfs_io utility can set the project ID on any file, but only a privileged user can do that.
To take a tree back out of project quota control, use project -C. It walks the tree recursively and clears the inodes from project quota control.
The project -c option checks whether a tree is set up. If everything's correct it prints nothing π€ If not, it prints the paths of inodes that either don't have the tree's project ID or don't have the inode flag set.
The -d option limits how deep the recursion goes: -1 is infinite, 0 is the top level only, 1 is the first level, and so on. The -p option lets you specify project paths on the command line, so you don't need /etc/projects to exist at all. Heads up though: if a projects file does exist, it gets used too β¨
π EXAMPLES π
Enabling quota enforcement on an XFS filesystem, to restrict a user to a set amount of space π
# mount -o uquota /dev/xvm/home /home
# xfs_quota -x -c 'limit bsoft=500m bhard=550m tanya' /home
# xfs_quota -x -c report /home
Enabling project quota on an XFS filesystem, to restrict files in the log file directories to only 1 gigabyte of space π¦
# mount -o prjquota /dev/xvm/var /var
# echo 42:/var/log >> /etc/projects
# echo logfiles:42 >> /etc/projid
# xfs_quota -x -c 'project -s logfiles' /var
# xfs_quota -x -c 'limit -p bhard=1g logfiles' /var
Same as above, but without needing any config files π§
# rm -f /etc/projects /etc/projid
# mount -o prjquota /dev/xvm/var /var
# xfs_quota -x -c 'project -s -p /var/log 42' /var
# xfs_quota -x -c 'limit -p bhard=1g 42' /var
β οΈ CAVEATS β οΈ
okay this one is important bestie π₯Ί The XFS allocation mechanism always reserves the maximum amount of space it needs before it goes ahead with an allocation. If there isn't enough space for that reservation, for example because the block quota limit has been reached, the allocation can fail even though there's actually enough space. So quota enforcement can sometimes kick in when the user is still under quota, and the end result of the operation would have stayed under quota if it had been allowed to finish. This extra overhead is usually in the range of tens of blocks.
Both of these things are unavoidable side effects of how XFS works, so keep them in mind when you're setting block limits π§
π BUGS π
Quota support for filesystems with realtime subvolumes isn't implemented yet π’ The quota warning mechanism isn't there either. On Linux, the warnquota(8) tool can give you similar functionality though π§
π FILES π
/etc/projectsβ maps numeric project identifiers to directory trees π²/etc/projidβ maps numeric project identifiers to project names π·οΈ
π SEE ALSO π
df(1), mount(1), sync(2), projid(5), projects(5), xfs(5), warnquota(8)
π And that's the whole xfs_quota(8) page, bestie! The footer on the original was just the page name, so there's no version or date to share, but you now officially know your quotas better than most people ππ¦
π¦ where this page comes from
- alpine 3.22: xfsprogs-doc 6.14.0-r0 Β· LGPL-2.1-or-later
- alpine 3.23: xfsprogs-doc 6.17.0-r0 Β· LGPL-2.1-or-later
- alpine 3.24: xfsprogs-doc 7.0.1-r0 Β· LGPL-2.1-or-later
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- centos-stream 10: xfsprogs 6.16.0-1.el10 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: xfsprogs 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- centos-stream 9: xfsprogs 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- debian bookworm: xfsprogs 6.1.0-1 Β· GPL-2.0-only
- debian trixie: xfsprogs 6.13.0-2+deb13u1 Β· GPL-2.0-only
- fedora 43: xfsprogs 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 43: xfsprogs 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: xfsprogs 6.19.0
- nixpkgs unstable: xfsprogs 7.2.1
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- ubuntu noble: xfsprogs 6.6.0-1ubuntu2 Β· GPL-2.0-only
- ubuntu noble: xfsprogs 6.6.0-1ubuntu2.1 Β· GPL-2.0-only
- ubuntu questing: xfsprogs 6.13.0-2ubuntu2 Β· GPL-2.0-only
- ubuntu resolute: xfsprogs 6.18.0-3 Β· GPL-2.0-only
- ubuntu stonking: xfsprogs 6.19.0-1 Β· GPL-2.0-only
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms