配额系统可以限制对用户与群组可用的磁盘空间。设置时,必须有核心支持它 (以 CONFIG_QUOTA
选项编译) — 使用 Debian 核心时。配额管理软件在 quota Debian 软件包内。
在文件系统内启用配额时,必须指明e usrquota
与 grpquota
选项于 /etc/fstab
中,分别供用户与群组使用。重新启动电脑后,就能在未使用的磁盘空间中更新配额 (必须如此,才能重新计算已使用的磁盘空间)。
edquota user
(或 edquota -g group
) 命令允许在仍有磁盘空间的前提下,改变配额。
配额系统允许设置四个限制:
two limits (called “soft” and “hard”) refer to the number of blocks consumed. If the filesystem was created with a block-size of 1 kibibyte, a block contains 1024 bytes from the same file. Unsaturated blocks thus induce losses of disk space. A quota of 100 blocks, which theoretically allows storage of 102,400 bytes, will, however, be saturated with just 100 files of 500 bytes each, only representing 50,000 bytes in total.
两种限制(软的和硬的)使用的节点(inode)数限制。每个文件至少需要一个包含存储信息(许可权限,所有者,最后读取时间,等)的节点。因此,它实际上是限制了用户文件的数量。
“软”限制可以被临时超越;当用户超过 warnquota
命令指定的配额,只是给出警告,通常有 cron
唤起该命令。“硬”限制不允许被超出:系统将会拒绝任何超出硬配额的操作。
使用命令 edquota -t
,可以设定超过软限制的“宽限期”时长。宽限期之后,软限制将作为硬限制处理,要将数据写入硬盘,用户必须减少磁盘使用量至配额之内。