Set Quota on your Linux system
The grace period parameter
The “grace period” parameter allow you to set a time limit before the soft limit value is enforced on a file system with quota enabled (see the soft limit above for more information). For example this parameter can be used to warn your users about a new policy that will set a quota of 5MB of disk space in their home directory in 7 days. You can set the 0 days default part of this parameter to any length of time you feel reasonable.
The changes of this setting require two steps as follows (in my example I assume 7 days). Stepi
• Edit the default grace period parameter, by using the following command:
[root@deep /]# edquota -t
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for users: /dev/sda6: block grace period: 0 days, file grace period: 0 days
Step 2
• Modify the grace period to 7 days. Change or set the following parameters in the vi editor:
Time units may be: days, hours, minutes, or seconds
Grace period before enforcing soft limits for users: /dev/sda6: block grace period: 0 days, file grace period: 0 days To read:
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for users: /dev/sda6: block grace period: 7 days, file grace period: 7 days
NOTE: The command “edquota -t” edits the soft time limits for each file system with quotas enabled.
Assigning quota for a particular group
Consider, for example, you have a group with the group id “webusers” on your system. The following command takes you into the vi editor to edit quotas for the group “webusers” on each partition that has quotas enabled:
• To edit and modify quota for group “webusers”, use the following command: [root@deep /]# edquota -g webusers
Quotas for group webusers:
/dev/sda6: blocks in use: 6, limits (soft = 0, hard = 0)
inodes in use: 6, limits (soft = 0, hard = 0)
The procedure is the same as for assigning quotas for a particular user; as described above, you must modify the parameter of “soft =” and save your change.
Assigning quota for groups of users with the same value
The edquota program has a special option (-p) that assign quotas for groups of users with the same value assigned to an initial user. Assuming that you want to assign users starting at UID 500 on the system the same value as the user “wahib”, we would first edit and set wahib’s quota information, then execute:
• To assign quota for group of users with the same value, use the following command: [root@deep /]# edquota -p wahib *awk -F: ‘$3 > 499 {print $1}’ /etc/passwcT
The edquota program will duplicate the quota that we have set for the user “wahib” to all users in the 7etc/passwd” file that begin after UID 499.