5.9.7. Implementing Disk Quotas
Red Hat Enterprise Linux is capable of keeping track of disk space usage on a per-user and per-group basis through the use of disk quotas. The following section provides an overview of the features present in disk quotas under Red Hat Enterprise Linux.
18.104.22.168. Some Background on Disk Quotas
Disk quotas under Red Hat Enterprise Linux have the following features:
- Per-file-system implementation
- Per-user space accounting
- Per-group space accounting
- Tracks disk block usage
- Tracks disk inode usage
- Hard limits
- Soft limits
- Grace periods
The following sections describe each feature in more detail.
22.214.171.124.1. Per-File-System Implementation
Disk quotas under Red Hat Enterprise Linux can be used on a per-file-system basis. In other words, disk quotas can be enabled or disabled for each file system individually.
This provides a great deal of flexibility to the system administrator. For example, if the
/home/directory was on its own file system, disk quotas could be enabled there, enforcing equitable disk usage by all users. However the root file system could be left without disk quotas, eliminating the complexity of maintaining disk quotas on a file system where only the operating system itself resides.
126.96.36.199.2. Per-User Space Accounting
Disk quotas can perform space accounting on a per-user basis. This means that each user's space usage is tracked individually. It also means that any limitations on usage (which are discussed in later sections) are also done on a per-user basis.
Having the flexibility of tracking and enforcing disk usage for each user individually makes it possible for a system administrator to assign different limits to individual users, according to their responsibilities and storage needs.
188.8.131.52.3. Per-Group Space Accounting
Disk quotas can also perform disk usage tracking on a per-group basis. This is ideal for those organizations that use groups as a means of combining different users into a single project-wide resource.
By setting up group-wide disk quotas, the system administrator can more closely manage storage utilization by giving individual users only the disk quota they require for their personal use, while setting larger disk quotas that would be more appropriate for multi-user projects. This can be a great advantage to those organizations that use a "chargeback" mechanism to assign data center costs to those departments and teams that use data center resources.
184.108.40.206.4. Tracks Disk Block Usage
Disk quotas track disk block usage. Because all the data stored on a file system is stored in blocks, disk quotas are able to directly correlate the files created and deleted on a file system with the amount of storage those files take up.
220.127.116.11.5. Tracks Disk Inode Usage
In addition to tracking disk block usage, disk quotas also can track inode usage. Under Red Hat Enterprise Linux, inodes are used to store various parts of the file system, but most importantly, inodes hold information for each file. Therefore, by tracking (and controlling) inode usage, it is possible to control the creation of new files.
18.104.22.168.6. Hard Limits
A hard limit is the absolute maximum number of disk blocks (or inodes) that can be temporarily used by a user (or group). Any attempt to use a single block or inode above the hard limit fails.
22.214.171.124.7. Soft Limits
A soft limit is the maximum number of disk blocks (or inodes) that can be permanently used by a user (or group).
The soft limit is set below the hard limit. This allows users to temporarily exceed their soft limit, permitting them to finish whatever they were doing, and giving them some time in which to go through their files and trim back their usage to below their soft limit.
126.96.36.199.8. Grace Periods
As stated earlier, any disk usage above the soft limit is temporary. It is the grace period that determines the length of time that a user (or group) can extend their usage beyond their soft limit and toward their hard limit.
If a user continues to use more than the soft limit and the grace period expires, no additional disk usage will be permitted until the user (or group) has reduced their usage to a point below the soft limit.
The grace period can be expressed in seconds, minutes, hours, days, weeks, or months, giving the system administrator a great deal of freedom in determining how much time to give users to get their disk usages below their soft limits.