Linux用户quote配置说明

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

一. Linux 配额(Quota)说明 在 Linux 系统中,由于是多人多任务的环境,所以会有多人共同使用一个硬盘空间的情况发生,为了合理使用这些空间,管理员需要控制用户对磁盘空间的使用,这个就是Linux 下的配额管理。 配额管理是对某个磁盘分区进行限制。这里的限制包括2个方面: 1.单个用户对某个目录下空间大小的限制。 2.单个用户对某个目录下文件个数的限制。 1.1 Quota 常用在如下几种情况 1) 针对 WWW server ,例如:每个人的网页空间的容量限制。 2) 针对 mail server,例如:每个人的邮件空间限制。 3) 针对 file server,例如:每个人最大的可用网络硬盘空间。 1.2 Quota 的2个注意事项 (1)仅针对整个 partition: quota针对『整个 partition』进行限制, 例如:如果/dev/hda5 是挂载在 /dave 目录下,那么在 /dave 目录下的所有目录都会受到限制。 (2)只对一般身份使用者有效: 不是所有在 Linux 上面的账号都可以设定 quota,例如 root 就不能设定quota 。 1.3 Quota 的三种限制类型 (1)soft limit: 这是最低限制容量的意思,用户在宽限期间之内,他的容量可以超过 soft ,但必需要宽限时间之内将磁盘容量降低到 soft 的容量限制之下。 (2)hard limit: 这是『绝对不能超过』的容量。通常hard limit 会比 soft limit 为高,例如网络驱动器空间为 30 MB ,那么 hard limit 就设定为 30MB ,但是为了让使用者有一定的警戒心,所以当使用空间超过 25 MB 时,例如使用者使用了 27 MB 的空间时,那么系统就会警告用户, 让使用者可以在『宽限时间内』将他的档案量降低至 25 MB ( 亦即是 soft limit )之内。也就是说, soft 到 hard 之间的容量其实就是宽限的容量,可以达到针对使用者的『警示』作用。 (3)宽限时间: 宽限时间就是当使用者使用的空间超过了 soft limit ,却还没有到达 hard limit 时,那么在这个『宽限时间』之内,就必需要请用户将使用的磁盘容量降低到 soft limit 之下。而当用户将磁盘容量使用情况超过 soft limit 时,『宽限时间』就会自动被启动,而在用户将容量降低到 softlimit 之下,那么宽限时间就会自动的取消。 1.4 Quota 的安装包 Quota也需要安装,安装包如下: [root@rhce /]# rpm -q quota quota-3.17-16.el6.x86_64 [root@rhce /]# 1.5 Quota 相关的命令 与Quota 相关的几个命令如下。 1.5.1 启用quota:quotaon [root@rhce /]# quotaon Bad number of arguments. quotaon: Usage: quotaon [-guvp] [-F quotaformat] [-x state] -a quotaon [-guvp] [-F quotaformat] [-x state] filesys … -a, –all turn quotas on for all filesystems -f, –off turn quotas off -u, –user operate on user quotas -g, –group operate on group quotas -p, –print-state print whether quotas are on or off -x, –xfs-command=cmd perform XFS quota command -F, –format=formatname operate on specific quota format -v, –verbose print more messages -h, –help display this help text and exit -V, –version display version information andexit [root@rhce /]# 1.5.2 关闭quota:quotaoff [root@rhce /]# quotaoff Bad number of arguments. quotaoff: Usage: quotaoff [-guvp] [-F quotaformat] [-x state] -a quotaoff [-guvp] [-F quotaformat] [-x state] filesys … -a, –all turn quotas off for allfilesystems -f, –off turn quotas off -u, –user operate on user quotas -g, –group operate on group quotas -p, –print-state print whether quotas are on or off -x, –xfs-command=cmd perform XFS quota command -F, –format=formatname operate on specific quota format -v, –verbose print more messages -h, –help display this help text and exit -V, –version display version information andexit 1.5.3 配额发送警告:warnquota [root@rhce /]# warnquota -h warnquota: Usage: warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile][-a adminsfile] -u, –user warn users -g, –group warn groups -s, –human-readable send information in more humanfriendly units -i, –no-autofs avoid autofs mountpoints -d, –no-details do not send quota informationitself -F, –format=formatname use quotafiles of specific format -c, –config=config-file non-default config file -q, –quota-tab=quotatab-file non-default quotatab -a, –admins-file=admins-file non-default admins file -h, –help display this help messageand exit -v, –version display version informationand exit Bugs to jack@suse.cz [root@rhce /]#

[1][2][3][4]

青春一经典当即永不再赎

Linux用户quote配置说明

相关文章:

你感兴趣的文章:

标签云: