[root@localhost ~]# vi /etc/fstab
[root@localhost ~]#
cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Aug 6 22:20:17 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or
blkid(8) for more info
#
UUID=0bb45273-d0fc-4329-95cf-e3570ccfd7f3 / ext4 defaults 1 1
UUID=6f7c1a9e-2c79-473d-b0ed-ca2bd1e32157 /boot ext4 defaults 1 2
UUID=9d064cb9-23f2-4e37-9224-0355159f1fc4 /home ext4 defaults,usrquota 1 2
UUID=dfdb72be-04a8-4d35-aa70-1716ef66fb50 swap swap defaults 0 0
tmpfs
/dev/shm tmpfs defaults 0 0
devpts
/dev/pts devpts gid=5,mode=620
0 0
sysfs
/sys sysfs defaults 0 0
proc
/proc proc defaults 0 0
[root@localhost
~]# rpm -qa | grep quota
quota-3.17-18.el6.x86_64
Ø Although
Red Hat supports quotas in the kernel by default but you can verify quota
support from the kernel with the following command:
[root@localhost ~]#
grep -i config_quota /boot/config-`uname -r`
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
Ø You
now need to remount the /home file system before the changes take effect.
[root@localhost ~]# mount -o remount /home/
[root@localhost ~]#
mount
/dev/vda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs
(rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/vda1 on /boot type ext4 (rw)
/dev/vda5 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/tmp on /tmp type none (rw,bind)
/var/tmp on /var/tmp type none (rw,bind)
/home on /home type none (rw,usrquota)
none on /sys/kernel/config type configfs (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon
(rw,nosuid,nodev)
[root@localhost ~]# quotacheck -um /home # create quota file
[root@localhost ~]# quotaon -uv /home # enable disk quota
/dev/vda5 [/home]: user quotas turned on
[root@localhost ~]# quotaon -p –a # show status
group quota on /home (/dev/vda5) is off
user quota on /home (/dev/vda5) is on
[root@localhost ~]# useradd ashwini
[root@localhost ~]# passwd ashwini
Changing password for user ashwini.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# edquota ashwini # set user quota to a user
'ashwini'
[root@localhost ~]#
repquota –a # show status
*** Report for user quotas on device /dev/vda5
Block grace time: 7days; Inode grace time: 7days
Block limits File
limits
User
used soft hard
grace used soft
hard grace
----------------------------------------------------------------------
root -- 20
0 0 2 0
0
xguest -- 36
0 0 9 0
0
ashwini -- 1024 12000000 15000000 20 0
0
[root@localhost ~]#
useradd desiree
[root@localhost ~]# passwd desiree
Changing password for user desiree.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# edquota desiree # set user quota to a user 'ashwini'
[root@localhost ~]# repquota –a # show status
*** Report for user quotas on device /dev/vda5
Block grace time: 7days; Inode grace time: 7days
Block limits File
limits
User
used soft hard
grace used soft
hard grace
----------------------------------------------------------------------
root -- 20
0 0 2 0
0
xguest -- 36
0 0 9 0
0
ashwini -- 5148
12000000 15000000 20 0
0
desiree -- 48 12000000 15000000 12 0
0
[root@localhost ~]# useradd mohan
[root@localhost ~]# passwd mohan
Changing password for user mohan.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# edquota mohan # set user quota to a user ' mohan '
[root@localhost ~]# repquota –a # show status
*** Report for user quotas on device /dev/vda5
Block grace time: 7days; Inode grace time: 7days
Block limits File
limits
User
used soft hard
grace used soft
hard grace
----------------------------------------------------------------------
root -- 20
0 0 2 0
0
xguest -- 36
0 0 9 0
0
ashwini -- 5148 12000000 15000000 20 0
0
desiree -- 48 12000000 15000000 12
0 0
mohan -- 48 12000000 15000000 12 0
0
[root@localhost ~]# useradd devraj
[root@localhost ~]#
passwd devraj
Changing password for user devraj.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# edquota devraj # set user quota to a user ' devraj '
[root@localhost ~]# repquota –a # show status
*** Report for user quotas on device /dev/vda5
Block grace time: 7days; Inode grace time: 7days
Block limits File
limits
User
used soft hard
grace used soft
hard grace
----------------------------------------------------------------------
root -- 20
0 0 2 0
0
xguest -- 36
0 0 9 0
0
ashwini -- 5148
12000000 15000000 20 0
0
desiree -- 48
12000000 15000000 12 0
0
mohan -- 48
12000000 15000000 12 0
0
devraj -- 48 12000000 15000000 12 0
0
[root@localhost ~]# useradd sriram
[root@localhost ~]# passwd sriram
Changing password for user sriram.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# edquota sriram # set user quota to a user
' sriram '
[root@localhost ~]# repquota –a # show status
*** Report for user quotas on device /dev/vda5
Block grace time: 7days; Inode grace time: 7days
Block limits File
limits
User
used soft hard
grace used soft
hard grace
----------------------------------------------------------------------
root -- 20
0 0 2 0
0
xguest -- 36
0 0 9 0
0
ashwini -- 5148 12000000 15000000 20 0
0
desiree -- 48 12000000 15000000 12 0
0
mohan -- 48
12000000 15000000 12 0
0
devraj -- 48
12000000 15000000 12 0
0
sriram -- 48 12000000 15000000 12 0
0
Note: 1 Block size is 4kb(4096) it's depends on file system size.
Here 15000000 KB is 15GB and 12000000KB= 12GB
Note: 1 Block size is 4kb(4096) it's depends on file system size.
Here 15000000 KB is 15GB and 12000000KB= 12GB
No comments:
Post a Comment