Create Group Quotas

by Mike on October 6, 2009 · 1 comment

in Server Management

Group Quotas allow you to manage the total resources used by a group.  This allows you to contain a group’s usage of disk space on the server.

Lesson 4 | Lesson 6

Here are the steps to create group quotas.
Add a Group
groupadd sales

Create a directory called sales.
mkdir /sales

Edit /etc/fstab to enable group quotas

vi /etc/fstab
/dev/sdb2   /sales           ext3                        defaults         1  1

Now change the default line above which is for a Logical Volume to the one below which enables quotas.

/dev/sdb2   /sales           ext3            usrquota, grpquota         1  1

Note that this example show both user and group quotas on the partition.  You do not have to have user quotas, you can work with group quotas alone.
Save the change and then mount the  /sales directory.

mount -a
If you make additional changes you will need to unmount and then remount the directory.

mount -o remount /sales

Start the quotacheck

Change to init level 1

init 1

Run the quotacheck command:

quotacheck -cug /sales

Return to runlevel 5 or runlevel 3 (text mode).

init 5

Turn the quota on

quotaon  /sales

Set user quota specifics

setquota -g sales  200  800  0   0   /sales

Test your settings as tom.  Note tom must be a member of the sales group. As root edit the /etc/group file and add tom and others that you want to be a part of the group.  Here tom,mary and joe are all a part of the group.

sales:x:1003:tom, mary, joe

su – tom

Move to the sales directory.
cd /sales

quota (this will show current quotas for the group)

Create some disk usage.

dd if=/dev/zero  of=filespace   bs=1k    count=150

quota (this will show current quotas for the group)

dd if=/dev/zero  of=filespace   bs=1k    count=900

Continue to add space and then evaluate the changes that occur.  Once the group reaches the soft limit there will be  a warning and a 7 day grace period.

Previous post:

Next post: