Check Who Filled the Disk with repquota

When a shared server runs low on space, repquota shows exactly which accounts are over their limits, in a read-only report you can also export as CSV. Allow about ten minutes.

You need the quota package, a filesystem with quotas already enabled, and usually sudo: the installed command only lets the super-user view quotas that are not their own. This guide describes quota 4.06-1build6, installed on Ubuntu as quota 4.06, and the options and output below are verified against that release.

1. Check the installed command and the target filesystem

Confirm which program will run and whether the target is mounted, with ordinary read-only commands:

$ command -v repquota
/usr/sbin/repquota
$ repquota --version
Quota utilities version 4.06.
$ findmnt -t ext4,xfs,btrfs
TARGET SOURCE   FSTYPE OPTIONS
/      /dev/md2 ext4   rw,relatime,quota,usrquota,grpquota

Replace / with the mount point you want to inspect. Do not pass a block device or an arbitrary directory: repquota expects a mounted filesystem path, or no path at all when you use --all.

Checkpoint: the mount options need to include the quota type you intend to report. usrquota covers user quotas and grpquota covers group quotas. A filesystem without an active quota setup produces an error rather than a table.

2. Run a first user report

Run the normal report with names disabled: faster, and more predictable to script against.

$ sudo repquota --user --no-names /
*** Report for user quotas on device /dev/md2
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
#1018      --  369368 10485760       0           2918     0     0

sudo is required here because a full report exposes other users' or groups' quotas. Do not grant a wider privilege than needed just to make the report easier to run: if you only need your own quota, the separate quota command is a better fit.

3. Read the two status characters

The two characters right after the account identify limit state: the first for block or space usage, the second for inode or file usage. A hyphen means the limit is not exceeded. A plus sign means the soft limit was exceeded, or the hard limit was reached with no soft limit set.

User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
#1018      --  369368 10485760       0           2918     0     0
#2048      +-  900000  800000 1000000 6days      1200     0     0

In this example, -- is within both kinds of limit, and +- means the account is over its space soft limit while its inode usage is fine. The grace column matters only once a limit is exceeded. Do not guess an account name from the numeric value: with --no-names, the command deliberately prints UID or GID values instead.

4. Choose names, speed or compact output

Once the basic report works, pick the presentation that matches the job:

For example, a readable user report that skips name lookups:

$ sudo repquota --user --human-readable --no-names /
*** Report for user quotas on device /dev/md2
                        Space limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
#1018      --    361M  10240M      0K           2918     0     0

The exact rows depend on current usage. The conversion changes display units only, not the stored quota values.

5. Produce CSV without changing quota state

For a script or an incident record, ask for CSV output and keep the header:

$ sudo repquota --user --no-names --output=csv / > quota-users.csv
$ sed -n '1,4p' quota-users.csv
User,BlockStatus,FileStatus,BlockUsed,BlockSoftLimit,BlockHardLimit,BlockGrace,FileUsed,FileSoftLimit,FileHardLimit,FileGrace
#1018,ok,ok,369368,10485760,0,,2918,0,0,
$ test -s quota-users.csv && echo 'CSV report written'
CSV report written

The file is a snapshot, not a live view: keep it protected if account IDs or usage are sensitive. Redirection creates or truncates the destination before repquota even runs, so choose a new path or back up first:

$ test ! -e quota-users.csv || cp --preserve=all quota-users.csv quota-users.csv.bak
$ sudo repquota --user --no-names --output=csv / > quota-users.csv.new
$ test -s quota-users.csv.new && mv quota-users.csv.new quota-users.csv

Recovery: if the command fails, inspect the error before replacing the old report. Remove an incomplete quota-users.csv.new only after checking it is no longer needed, and keep the backup available rather than deleting it as part of an unattended first run.

6. Report every quota-enabled filesystem

Use --all for every filesystem marked for quotas in /etc/mtab and mounted read-write:

$ sudo repquota --all --user --no-names
*** Report for user quotas on device /dev/md2
Block grace time: 7days; Inode grace time: 7days

This can take longer than naming one mount point, especially when many IDs need resolving. Add --no-autofs to skip mount points provided by an automounter. If output stalls during name translation, try --no-names. The command normally picks a lookup strategy from /etc/nsswitch.conf; --cache suits large batches and --no-cache translates entries individually, so the right choice depends on whether accounts come from local files or a directory service.

7. Diagnose failures without changing anything

A permission error for aquota.user or aquota.group usually means the report ran without enough privilege: retry the same read-only command with sudo. A missing or wrong-format quota file means the mount's quota setup needs investigating; do not create, delete or repair quota files based only on this report.

$ findmnt --target /
$ sudo ls -l /aquota.user /aquota.group
$ sudo repquota --user --no-names /

Warning: do not use repquota to enable quotas, set limits or rebuild accounting data. Those are separate administrative operations with their own risks. This guide changes no persistent state, so there is no service restart or quota rollback step to run afterwards.

Done means