Quota’s Concept on Linux

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

LABEL=/home     /home    ext3 defaults,usrquota 1 2

(add usrquota beside defaults)

#mount -o remount,rw /home

(to remount /home partition)

to check quotas
#quotacheck -Mc /home

to on quota

# quotaon /home

to set quota for an user

# edquota -u

/dev/sda11      blocks    soft    hard inodes soft hard
36   0        0             4               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 johns quota for user sam

#edquota -p john sam

To work with group quota

to work with groupquota we have to create quota enabled partition

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

#mount -o  usrquota,grpquota

#quotacheck -cugv

edquota -g