What is Disk Quotas?
Quotas are used to restrict the amount of hard disk space occupied by a user or a group.
- Group level quota can only be applied to primary groups.
- Quotas only be applied on quota enabled partition.
Quotas can be applied in two ways:
- Based on the number of inodes (number of files ).
- Based on the number of blocks (volumes of hard disk space).
To check the block size use the command blockdev – getbsz <partition>
There are two Quotas limits:
- Soft – Soft quota limits will only warn the user that they have reached their quota limits.
- Hard – Hard quota limits will not allow the user to create any more files or directories once the quota limit has been reached.
Steps to Apply Quotas
- Create a new partition.
- Format the partition.
- Create an directory.
- Mount the partition on the directory with quotas enabled.
- Give full permissions to the partition.
- Create the quota database file.
- Turn on the quotas.
- Assign the quotas to the users or groups.
- Applying Quotas on a Partition
To mount the partition with quotas enabled
[firstname.lastname@example.org~]# mount –o usrquota, grpquota <partition name > <mount point>
Generate the quotas database file
[email@example.com~]# quotacheck –cugv <mount point>
-c Create new database -g Group
-u user -v Verbose
Turn on the quota
[firstname.lastname@example.org~]# quotaon < mount point>
Assigning quotas to users and groups
[email@example.com~]# edquota –u <user name >
[firstname.lastname@example.org~]# edquota –g <group name>
Disk Quotas for user <username > (uid <uid>)
Filesystem blocks soft Hard inodes soft hard
/dev/hda9 0 0 0 0 0 0
Congratulations now you have assigning the Disc Quotas.