Set quota to User Group on CentOS Redhat RHEL Fedora

Howto set quota to User Group on Centos Redhat RHEL Fedora

User Quota

  • Quotas keep users or groups from taking all the hard disk space on a partition. Linux Admininistrators commonly use disk quatos to regulate the amount of space occupied by any user for data, email, database …. It will help Linux not be crashed because of full hard disk.
  • We can configure Quotas to limit on the number of inodes.

Set Quotas on Ubuntu – Debian – Linux Mint

http://ithelpblog.com/os/linux/debian/ubuntu-debian/set-quota-user-group-ubuntu-debian-linux-mint/

Step 1: Check Quota package which install on your system or not.

[root@dhcppc11 ~]# rpm -qa | grep quota
quota-3.17-18.el6.x86_64

Step 2: Remount / filesystem and check quota in your system

[root@dhcppc11 ~]# mount -o remount /
[root@dhcppc11 ~]# quotacheck -avugm
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an u nclean shutdown.
quotacheck: Scanning /dev/sda2 [/] done
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Checked 17312 directories and 140245 files
quotacheck: Old file not found.
quotacheck: Old file not found.

Step 3: Turn quota on on User and Group

[root@dhcppc11 ~]# quotaon -avug
/dev/sda2 [/]: group quotas turned on
/dev/sda2 [/]: user quotas turned on

Step 4:  Quota report for all users and group

[root@dhcppc11 ~]# repquota /
*** Report for user quotas on device /dev/sda2
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 3697036 0 0 138769 0 0
daemon — 8 0 0 3 0 0
lp — 8 0 0 2 0 0
abrt — 20 0 0 4 0 0
haldaemon — 8 0 0 2 0 0
postfix — 96 0 0 47 0 0
ntp — 8 0 0 2 0 0
apache — 20 0 0 5 0 0
avahi — 8 0 0 3 0 0
pulse — 4 0 0 1 0 0
gdm — 288 0 0 48 0 0
user — 1004 0 0 136 0 0
named — 7072 0 0 251 0 0
mysql — 31720 0 0 396 0 0
cacti — 184 0 0 6 0 0
postgres — 187140 0 0 6060 0 0
ingres — 683964 0 0 1812 0 0
nagios — 228 0 0 13 0 0
squid — 88 0 0 10 0 0
#503 — 12708 0 0 32 0 0

For group

[root@localhost ~]# repquota -g /
*** Report for group quotas on device /dev/sda2
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
Group used soft hard grace used soft hard grace
———————————————————————-
root — 3695404 0 0 138640 0 0
daemon — 8 0 0 3 0 0
sys — 16 0 0 3 0 0
tty — 28 0 0 2 0 0
lp — 344 0 0 63 0 0
mail — 148 0 0 7 0 0
man — 128 0 0 32 0 0
lock — 20 0 0 2 0 0
nobody — 112 0 0 1 0 0
dbus — 48 0 0 1 0 0
utmp — 152 0 0 6 0 0
utempter — 4 0 0 1 0 0
abrt — 20 0 0 4 0 0
haldaemon — 8 0 0 2 0 0
postdrop — 400 0 0 4 0 0
postfix — 40 0 0 33 0 0
ntp — 12 0 0 3 0 0
apache — 232 0 0 15 0 0
avahi — 8 0 0 3 0 0
pulse — 4 0 0 1 0 0
fuse — 32 0 0 1 0 0
gdm — 304 0 0 52 0 0
stapusr — 160 0 0 1 0 0
slocate — 40 0 0 2 0 0
user — 1004 0 0 135 0 0
named — 7120 0 0 263 0 0
mysql — 31720 0 0 396 0 0
postgres — 187140 0 0 6059 0 0
ingres — 683964 0 0 1811 0 0
nagios — 240 0 0 16 0 0
squid — 96 0 0 12 0 0
wbpriv — 4 0 0 1 0 0
kevin — 1000000 0 0 42 0 0
[root@localhost ~]#

Step 5: Set quota to User: kevin with 1000Mb on your Linux box

[root@dhcppc11 ~]# useradd kevin
[root@dhcppc11 ~]# passwd kevin
Changing password for user kevin.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@dhcppc11 ~]# setquota -u kevin -F vfsv0 0 1000000 0 0 /dev/sda2

Step 6: Test by copy files to /home/kevin with user kevin

[root@localhost ~]# repquota /
*** Report for user quotas on device /dev/sda2
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 3697076 0 0 138771 0 0
daemon — 8 0 0 3 0 0
lp — 8 0 0 2 0 0
abrt — 20 0 0 4 0 0
haldaemon — 8 0 0 2 0 0
postfix — 96 0 0 47 0 0
ntp — 8 0 0 2 0 0
apache — 20 0 0 5 0 0
avahi — 8 0 0 3 0 0
pulse — 4 0 0 1 0 0
gdm — 288 0 0 48 0 0
user — 1004 0 0 136 0 0
named — 7072 0 0 251 0 0
mysql — 31720 0 0 396 0 0
cacti — 184 0 0 6 0 0
postgres — 187140 0 0 6060 0 0
ingres — 683964 0 0 1812 0 0
nagios — 228 0 0 13 0 0
squid — 88 0 0 10 0 0
kevin — 1000000 0 1000000 43 0 0
[root@localhost ~]#

Step 7: If you want to edit quota for user or group, example you want to edit Quota to “kevin”

[root@localhost ~]# edquota kevin
Disk quotas for user kevin (uid 503):
Filesystem blocks soft hard inodes soft hard
/dev/sda2 1000000 0 1000000 43 0 0
~

Thanks for using IThelpblog.com.

 

 

 

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>