Set quotas

You can assign a disk quota to a user using the edquota USER_NAME command. This command opens up the quota settings for the specific user in a text editor, like in this example:

linux edquota command

As you can see from the output above, the current quota information for the user bob are shown. The first column represents the file system that has quotas enabled (/dev/sdc1 in this example). The second column shows how many blocks the user is currently using (5, one block equals 1 KB). The next two columns are used to set the soft and hard block limits for the user (0 means that no limits have been set). The inodes column shows how many inodes the user is currently using (4). The last two columns set the soft and hard inode limits for the user.

We can set the soft block limit to 6 and the hard block limit to 10:

linux edquota set block limit

Let’s see what will happen when bob exceeds the hard limit:

linux quota hard limit exceeded

In the picture above you can see that the user bob is prevented from creating new files because his disk space usage is higher than the hard block limit.

To set a grace period (a time limit before the soft limit is enforced) on soft quotas, use the edquota command with the -t option:

linux edquota set grace period

As you can see from the picture above, the grace periods are set on a per-filesystem basis, not on a per-user basis.

 

To edit quotas for a group, use the edquota command with the -g option. For example, to edit quotas for the group named users, run the edquota -g users command. This will open up the quota settings for that group:

linux edquota set quotas for groups

Geek University 2022