Quota

From Leo's Notes
Revision as of 18:59, 14 June 2013 by Leo (talk | contribs)
This page was last edited on 14 June 2013, at 18:59.

Installation

To enable quotas under Linux (RH based), you will need the quota package.

yum install quota

You will then need to make your mounts support quotas using usrquota as a option. For example, in fstab, to make /export have quota support:

/dev/sdb1               /export                 ext4    defaults,usrquota 1 2

Remount the mount to apply:

mount -o remount /export

With quotas enabled, you will need to create your quotas

quotacheck -cug /export

Note that:

* -c  - creates
* -u  - quotas for users
* -g  - quotas for groups

Configuration

Use edquota or setquota to modify the quota for a specific user.

When you run edquota leo3 you will see:

1 Disk quotas for user leo3 (uid 1061):
2   Filesystem                   blocks       soft       hard     inodes     soft     hard
3   /dev/sdb1                     91380          0          0       1127        0        0

By default, there is no quotas for users (hence 0). To specify the soft/hard values for both blocks and inodes, edit the appropriate columns and then save and quit the editor.

1 Disk quotas for user leo3 (uid 1061):
2   Filesystem                   blocks       soft       hard     inodes     soft     hard
3   /dev/sdb1                     91380     102400     153600       1127     8000     9000

In the above example, I gave leo3 100MB of (soft) quota and a 150MB hard limit. The number of inodes enforces a file limit. That is, I have given leo3 an upper limit of 8000 (soft) file/directories and a upper hard limit of 9000.

You may set the grace period by running

edquota -t