Monday, August 19

Quota's Concept on RHEL/CentOS 6

  Quota allows Administrator to specify restriction in two ways :

  1) Restricting a user or a group by creating files in a specific location.
  2) Restricting a user or a group by the disk space in a specific location.
    
The idea behind quotas is that users are forced to stay under their disk consumption limit or with number of files in a particular location.


Quota is handled on a per user, per file system basis.

Quotas are of two types :
   User level quotas      - usrquota
   Group level quotas     - grpquota



To apply userquota

vi /etc/fstab

/dev/sda5     /home    ext4  defaults,usrquota 0 0

(add usrquota beside defaults)

#mount -o remount,rw /home

(to remount /home partition)


to check quotas
#quotacheck -cvug  /home


to on quota

# quotaon /home

to set quota for an user

# edquota -u  <username>

/dev/sda5      blocks    soft    hard inodes soft     hard
32          0          0         12        0         0



here blocks means the data already present in that users home directory
soft means at which space u want to send a warning to user 
hard means at which space u want to restrict user to write into his home directory
note: for both soft&hard we have to add block size
by defaults quotas will be in off mode we have to manually switchon quotas
#quotaon /home

to check:
1)login as user

type dd if=/dev/zero of=myfile bs=1024 count=10

dd =diskdrive
if = input file (/dev/zero means it's  a null file)
of = output file 
bs=blocksize(default in bytes)
count= howmany no.of blocks u want to create


to check quota as an admin
#repquota /home


to set users mahesh quota for user suresh

#edquota -p mahes suresh


To work with group quota



 to work with groupquota we have to create quota enabled partition


create a partition
format with ext4 file system
create a new mountpoint

#mount -o  usrquota,grpquota <mountpoint>

#quotacheck -cugv <qoutamountpoint>

edquota -g <groupname> 

1 comment:

:: Linux - Legends ::