Quotas are used to limit the usage of the hard drive space by users or group.

Types of quota limits:

soft : you get a warning if you go over your limit, but you can still write to the disk.
hard : when you reach the hard limit, you can't write to the disk anymore.

Preparing our system for quotas:

In order to be able to use quotas, we would need to mount our hard drive with quotas enabled, as we can see below in the "/etc/fstab" file:


grpquota: it could also be used for enabling quotas for groups.

Remark:

We would need to reboot the system for the changes to take effect.

Quotas for users:

We enable the quota check for the users files on all the partition with quotas enabled using:


-a: all partitions that have quota enabled
-u: user

"aquota.user" file  is created on the disk, it shows all the files and their respective owners.
Then we can enable the quotas using the below command:


Editing quotas for users:

We can edit quotas for the user "debian" using the below command:


We could set up quotas for inodes or blocks as we can see above.
|The inode means basically a file or a directory in the filesystem
.

blocks: blocks used by the user "debian".
inodes: inodes used by the user "debian".

Remark:

Using quotas on inodes doesn't prevent users for creating big files.
Quotas on blocks are more restrictive,. Each block is one kilobyte in size.

Testing the block size quota for user "debian":

The user "debian" could test the soft and hard limit of the block size by trying to exceed the soft and also the hard quotas.


The user "debian" went over the soft limit of 10000 kilobytes by writing "100k *101 = 10100 kilobytes" to "file_1". 
He will receive a warning from the system.

Using the below command, the user "debian" went over the hard limit of 20000 kilobytes by writing "100k *101 = 10100 kilobytes" for "file_1" in the above example, and another 10100 kilobytes for "file_2".


Writing to the disk will not be possible anymore for the user "debian".
Brando Sabatini and Ikbal C ©. Powered by Blogger.