Sometimes, a user can cause serious problems for other users on the system by consuming too much disk space. You can use disk quotas to specify the maximum disk space allocated to each user or group. In Linux, there are two types of disk quotas:
- hard limits – inflexible and used to set a specific limit that can’t be passed.
- soft limits – flexible and allow users to pass the limit for a specified time (one week, by default), but when they do so, the system issues warnings.
For example, let’s say that a user is allocated a disk quota on the system, 5 GB of space as the hard limit and 3 GB as the soft limit. If the user exceeds the soft limit (3 GB), the grace period clock starts. After the specified time limit expires, if the user hasn’t dropped back under 3 GB, the user is blocked from using any additional disk space. If the user reaches the hard limit (5 GB), he or she will not be able to create new files.
You can define disk quotas in two ways:
- usage (block) quota – limits the amount of disk space that can be used.
- inode (file) quota – limits the number of files that can be created. Each file in Linux consumes a single inode, so the inode limits are effectively limits on the number of files a user may own.