Configuration of Quotas in linux

# Configuration of Quotas.
--------------------------
# Configuration Steps:
----------------------
# User Quotas:
---------------
# Add the 'usrquota' word in /etc/fstab file as shown,
vi /etc/fstab
LABEL=/home /home ext3 defaults,usrquota 1 2
:wq

# If entry of /home partition is not present in /etc/fstab, then use command,
mount -o remount,usrquota /home

# Then Reboot the system or use following command.
mount -o remount /home
quotacheck -cM /home -Create and Manage

# Add the user to which you can assign a quota.
useradd user1
passwd user1

# Turn on the quota for /home.
quotaon /home

# Then edit the user quota by giving the command,
edquota user1

Disk quotas for user user1 (uid 500):
user definable
Filesystem blocks soft hard inodes soft  hard
   hard
    0   0  30 70   0 0     0
:wq
# Upper line means; soft limit=30KB and hard limit=70KB.

# Goto another console and login as user1 and create the files to verify the set  quota.
dd if=/dev/zero of=/home/user1/f1 bs=1024 count=10

# Means;  Filesize=bsxcount
#  =1024x10
#  =10240Bytes.   i.e. 10KB.
# Goto the root login and observe the quota by using following command. While   observing the quota, it may vary by Block Size of 4KB or 8KB.
repquota -a

# Also we can establish Grace Period to users
edquota -t

Filesystem Block Grace Period Inode Grace Period
/dev/hda9 7days 7days
:wq

# When the soft limit of quota will be exceeded, warning message will be        displayed. At this moment Grace time period will start and after expiration of  Grace period user can't write the data.

# Configuration of Group Quotas:
--------------------------------
# Add the 'grpquota' word in /etc/fstab file as shown,
vi /etc/fstab
LABEL=/home /home ext3 defaults,grpquota 1 2
:wq

# Then Reboot the system or use following command.
mount -o remount /home
quotacheck -guv /home -Create and Manage

# Add the group to which you can assign a quota.
groupadd cms

# Also add the users and put them in the group of cms
useradd user1;passwd user1
useradd user2;passwd user2
useradd user3;passwd user3
vim /etc/group
cms:x:501:user1,user2,user3
:wq

# Turn on the quota for /home.
quotaon /home

# Then edit the user quota by giving the command,
edquota -g cms

Disk quotas for group cms (gid 501):
user definable
Filesystem blocks soft hard inodes soft  hard
   hard
    0   0  30 70   0 0     0
:wq
# Upper line means; soft limit=30KB and hard limit=70KB.

# Goto another console and login as user1 and create the files to verify the set  quota. You can check for other group members also.
dd if=/dev/zero of=/home/user1/f1 bs=1024 count=10

# Goto the root login and observe the quota by using following command. While   observing the quota, it may vary by Block Size of 4KB or 8KB.
repquota -a


Comments

Popular Posts

Install and configure rsyslog Centralized logging server in CentOS

How to fix postfix/smtp Network is unreachable error

Could not join realm: Necessary packages are not installed: sssd-tools sssd libnss-sss libpam-sss adcli