How to configure and manage system user quota on RedHat server.

1. Understanding the user’s quota file structure.

Below is an example of a user’s quota file:

Disk quotas for user bob (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/hda2 1944 0 0 120 0 0

Each column represents the following (working from left to right):

* Filesystem – Linux filesystem that you are configuring quotas on for the specific user.

* Blocks – Number of blocks (Kilobytes) the user is currently using.

* Soft – The soft limit for the amount of blocks (Kilobytes) the user can use. The soft limit can be surpassed, up to the hard limit, but only for a specified grace period – which is also configurable.

* Hard – The hard limit for the amount of blocks (Kilobytes) the user can use. The hard limit is the maximum limit that can be used by the user and cannot be surpassed.

* Inodes – Number of inodes the user is currently using. An inode is used for every file or directory on a linux filesystem. Limiting the number of inodes is usually not as important to most system administrators as limiting block usage – however, it isn’t a bad idea to limit a user’s inode usage too, as a filesystem can run out of inodes (which will deny the server from creating any new files or directories).

* Soft – The soft limit for the amount of inodes the user can use. The soft limit can be surpassed, up to the hard limit, but only for a specified grace period.

* Hard – The hard limit for the amount of inodes the user can use. The hard limit is the maximum limit that can be used by the user and cannot be surpassed.

2. Defining or editing the quota limits for a user.

To define or edit a user’s quota limits on your RedHat server, use this command:

edquota -u

example: edquota -u bob

After executing the edquota command, it will bring up the specified user’s quota file (shown in step 1) in the popular editor ‘vi’ (for more information on how to use vi, please see our knowledgebase article pertaining to such). Change the soft/hard limits for the user’s block and inode usage as you see fit. Setting any of the user’s limits to ‘0’ provides unlimited usage for that particular setting. Once you are finished setting the user’s limits, save and exit the file – the settings you have edited will be applied immediately.

3. Viewing a user’s quota limits.

To view the changes you’ve just made, or, to view any user’s current quota limits, use the command below:

quota -u

example: quota -u bob

Also, to see a summary of all of your system users’ quota usage, use this command:

repquota -a

That’s it and you’re done 🙂

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s