Wednesday, April 1, 2015

How to enable User and Group Disk Quota on CentOS 7 & RHEL 7

As a Linux system admin we generally
face low disk space issues. By implementing the user and group disk
quota on the file system we can resolve the space issue.

Quota restricts the users to use only
allowed disk and inodes on the particular file system. In this post we
will discuss how to enable user & group disk quota on /home File
system on CentOS 7 & RHEL 7

Step:1 Add usrquota & grpquota option on /home in /etc/fstab file.

[root@linuxtechi ~]# vi /etc/fstab

Save & exit the file.
In this example i have add user and group quota options on /home

Step:4 Assign user & group disk quota via edquota commands

Syntax # edquota -u # edquota -g

[root@linuxtechi ~]# edquota -u jack

[root@linuxtechi ~]# edquota -g sys_admin

As shown above we have two kind of Disk quota limits :soft : It will warn the users if the soft limit of
disk quota reached ( size is in KB), in above example for jack user soft
limit is 5500 KB ( approx 5.5MB )hard : It will not allow the users to create new
files once the hard limit is reached. ( Size in KB ), in above example
hard limit for jack user is 6000 KB ( approx 6 MB )Note : We can also set the Quota on the basis of the
inodes ( i.e numbers of files that the user can create on particular
file system)
Let’s take an example , login as jack user and try to create a file of 8MB.