Quota tutorial / Mini HOWTO for modern linux distros such as Redhat Linux 7.2,
7.3, 8, 9, Enterprise versions, CentOS etc etc.
1. Edit file /etc/fstab to add qualifier "usrquota" (for user) or/and "grpquota" (for groups) to the partition in which you want
to add quota support. For example here I've added both types to my / (root) partition.
Make sure there are NO SPACES after "defaults" and up to your qualifiers that you add.
LABEL=/       /       ext3     defaults,usrquota,grpquota      1 1
2. Create files aquota.user (and aquota.group if you want to add group quota support) on the root of the partition
that you added quota support to. Following the above example:
touch /aquota.user
Then change the permissions on these files as such
chmod 600 /aquota.user
3. Run quotacheck
quotacheck -va
Note: If you are trying to enable quota on the / partition you might get an error such as
"quotacheck: Can't find filesystem to check or filesystem not mounted with quota option."
In that case run "quotacheck -vam" and then "quotacheck -vgam" (for groups)
If you still get the error then reboot the system.
Make sure that if you are
using the -m flag that no other process will be
writing to that partition. If you are unsure you are recommended that you
start the system in single user mode.
You may get this warning:
quotacheck: WARNING - Quotafile //aquota.user was probably truncated. Can't save quota settings...
This is nothing to worry about.
4. Turn quota on
quotaon -av
5. Now you are ready to edit quotas. Edit a user quota with the command "edquota -u user"
and edit a group's quota with the command "edquota -g group". Both of these commands will run vi by
default and give you the ability to edit the quota for the user/group. For example
[root@localhost root]# edquota -u testuser
Disk quotas for user testuser (uid 504):
Filesystem      blocks    soft    hard    inodes    soft    hard
/dev/hda3         40          0       0        11           0       0
The above shows the testuser using 40 blocks (1 block = 1 KB) and no soft or hard quotas on block usage, using 11
inodes and no soft or hard quotas on inodes.
After editing the file to give the user 5 MB soft limit and 6 MB hard limit the file would look something like
this
Disk quotas for user testuser (uid 504):
Filesystem      blocks        soft        hard      inodes    soft    hard
/dev/hda3         40          5120       6144        11           0       0
Soft limit indicates the maximum amount of disk usage a quota user has on a partition.
When combined with "grace period" it acts as the border line, which a quota user is issued
warnings about his impending quota violation when passed. Hard limit works only when "grace period"
is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his
"hard limit".
You can edit the grace period with the command "edquota -t" to edit grace period.
Misc:
To show your quota : "quota"
To show a users quota : "quota -u user"
To show all users quota usage : "repquota -a"
Page last updated: June, 04 2007
-- Steve O.
Back to the main page