|
Page 3 of 3
Assigning Quota Policies
Now that we have configured our system with quota support, we are now ready to assign quota policies for our users and groups.
Before we begin however, its important to understand some of the terminology for policy enforcement. We will begin with limits. There are two types of limits, soft and hard. A soft limit provides a threshold for block count and/or inode usage that will trigger a warning message to a user/group once exceeded if used in conjunction with a grace period - more on grace periods in a moment. A hard limit, which also requires a grace period to be set, servers as a boundary for block counts and/or inode usage that a user/group can not exceed.
Grace periods serve as a count down for soft limit enforcement. Once the soft limit threshold has been passed, the grace period count down begins. Once the user/group's grace period has run out, the soft limit will be enforced as a hard limit. Grace periods are configured on a per file system bassis and can be set to seconds, minutes, hours or days.
Now that we understand limits and grace periods, we are ready to setup a quota. In the following example, we will set a quota for the user thirt, and set the default grace period for the / and /home file systems. We will set a block soft limit of 90MB, hard limit of 100MB with a 7 day grace period for /home and /. Let's begin!
- Start by editing the user's quota
[root@Linux01 /]# edquota thirt
|
- When edquota runs, you will be sent into the editor specified by your $EDITOR environment variable.
Note: If you are using the pico or nano editors, be very careful to avoid the line wraps associated with editing this file. Each file system should be contained on 1 line only!
You will see each of the file systems we have enabled quota support on (from the /etc/fstab) listed with the currently in-use blocks and inode counts for the user. Edit the users quota by changing the soft/hard columns of either the blocks and/or inodes for a given file system.
In the below, we will sets thirt's block quota to a warning limit of 90MB (90MB x 1024K = 92160 blocks) and a panic limit of 100MB (100MB x 1024K = 102400 blocks) on the /home file system (/dev/mapper/VolGroup00-LogVol00)
| Disk quotas for user thirt (uid 500): |
| Filesystem |
blocks |
soft |
hard |
inodes |
soft |
hard |
| /dev/mapper/VolGroup00-LogVol04 |
0 |
0 |
0 |
0 |
0 |
0 |
| /dev/mapper/VolGroup00-LogVol00 |
88 |
92160 |
102400 |
13 |
0 |
0 |
|
Note: A soft/hard limit of zero means no limit will be enforced
- Set the default grace period for each file system (this can be overridden on a per user bassis with a -T command line switch, see the edquota man pages for additional details.)
Set the default grace period for the / file system:
[root@Linux01 /]# edquota -f / -t
|
| Grace period before enforcing soft limits for users: |
| Time units may be: days, hours, minutes, or seconds |
| Filesystem |
Block grace period |
Inode grace period |
| /dev/mapper/VolGroup00-LogVol04 |
7days |
7days |
|
Set the default grace period for the /home file system:
[root@Linux01 /]# edquota -f /home -t
|
| Grace period before enforcing soft limits for users: |
| Time units may be: days, hours, minutes, or seconds |
| Filesystem |
Block grace period |
Inode grace period |
| /dev/mapper/VolGroup00-LogVol00 |
7days |
7days |
|
- Verify the quota configuration
Print all file systems and user/group quota information:
| [root@Linux01 /]# repquota -a |
| *** Report for user quotas on device /dev/mapper/VolGroup00-LogVol04 |
| Block grace time: 7days; Inode grace time: 7days |
|
|
Block limits |
File limits |
| User |
|
used
|
soft
|
hard
|
grace |
used
|
soft
|
hard
|
grace |
| root |
-- |
2391528 |
0 |
0 |
|
89211 |
0 |
0 |
|
rpm
|
-- |
796 |
0 |
0 |
|
49 |
0 |
0 |
|
|
| *** Report for user quotas on device /dev/mapper/VolGroup00-LogVol00 |
| Block grace time: 7days; Inode grace time: 7days |
|
|
Block limits |
File limits |
| User |
|
used
|
soft
|
hard
|
grace |
used
|
soft
|
hard
|
grace |
| root |
-- |
41428 |
0 |
0 |
|
8 |
0 |
0 |
|
thirt
|
-- |
88 |
92160 |
102400 |
|
13 |
0 |
0 |
|
|
|
Print a single user/groups quota information
| [root@Linux01 /]# quota thirt |
| Disk quotas for user thirt (uid 500): |
| Filesystem |
blocks |
quota |
limit |
grace |
files |
quota |
limit |
grace |
| /dev/mapper/VolGroup00-LogVol00 |
88 |
92160 |
102400 |
|
13 |
0 |
0 |
|
|
That's it! You should now be well on your way to configuring quotas in Linux! Best of luck!
Add this page to your favorite website
|