After talk about special character on linux command last week, now let understand on disk quota here. In Linux, a system of disk quotas enables the system administrator to restrict disk usage by individuals and groups.

linux

Quotas can specify

  • the maximum amount of total disk space allotted to a user or group
  • The maximum number of files a user or group can create

You assign quotas by partition, so an individual or group who creates files on two partitions may have a different quota for each partition, or a quota for only one of the two partitions.

User and group quotas
User quotas and group quotas are independent of each other – so the value of the group quota is not the sum of the values of the users’ quotas in a group. When a user attempts to create a file, Linux first checks if there is a group quota for the user’s group. If a group quota for the group to which the user belongs has already been filled, the user can’t create the file, regardless of the status of the user’s quota. To create the file, the user must change groups. Every file that an individual user creates counts towards the quota of the user’s group. If the user isn’t part of a quota-restricted group, or if group quotas aren’t switched on for a partition, the user can create files on the partition as long as the user’s quota isn’t filled.

Hard and soft limits
When you set quotas, you can specify both a hard and a soft limit. When a user exceeds a soft limit, a warning is issued, but the user can continue to create files for the duration of a grace period. The default grace period is seven days, but the administrator can change this period. At the end of the grace period, the user must reduce their disk usage so that they don’t exceed the soft limit. The soft limit acts as a warning to the user that they are approaching a hard limit. When the user reaches a hard limit, they can no longer create files at all.

Viewing quotas
The quota command checks the file system in the /etc/fstab directory for quotas and reports them. As a root user, you can use the quota command to view the quotas of any user or group on a system. Users can check their own quotas and the quotas of any groups to which they belong. The syntax for viewing quotas is

quota option who

In the syntax, who can be either a username or a group name.

The following options are used with the quota command:

  • g checks a group quota
  • u checks a user quota
  • q checks which quotas have been filled

Users can use the -g option and the -u option together, to check both their user and group quotas.

The repquota command reports quotas and provides a summary of disk usage for a specified file system. So you can see how many files a user or group owns in a file system and how much space they occupy. The syntax for using the repquota command is

repquota options file_system

The following table shows the repquota command options.

Options for the repquota command

disk quotas in linux

As for the quota command, the root user can use the repquota command to view all quotas in the system, whereas other users can view only their own user and group quotas.

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock