免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1006 | 回复: 0
打印 上一主题 下一主题

Quota on Redhat Linux OS [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-10 00:02 |只看该作者 |倒序浏览

                                                                                                                                                 1. edit the file /etc/fstab, include usrquota and grpquota parameter, such as follow:
/dev/sdb1               /disk2                  ext3    defaults,usrquota,grpquota        1 2
2. remount the partition via the follow command:
mount -o remount /disk2
3. verify parameter via follow command
cat /etc/mtab
make sure the deferent contents include usrquota and grpquota parameter with disk1 mount point, as follow:
/dev/sdb1 /disk2 ext3 rw,usrquota,grpquota 0 0
4. perform quotacheck -avug to create aquota.user and aquota.group file under quota partition automatically
5. specify quota for user by edquota -u sgzhang command
Disk quotas for user sgzhang (uid 1372):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/sdb1                   2369048     500000     520000          3        0        0
6. perform quotaon  -av to run quota process
7. finished
RHEL5下的磁盘配额
一.   相关指令:
     a.查询功能(quota,quotacheck,quotastats,warnquota,repquota)
b.编辑功能(edquota,repquota)
二.步骤:
1.开启磁盘的quota功能:编辑/etc/fstab,使准备quota的磁盘支持.
2.预扫描磁盘的使用情况:使用quotacheck扫描要使用的磁盘.
3.编辑用户的quota:edquota
4.启动 quota:quotaon.
三.具体范例:
针对test群组下的两个用户test和test1,使每个用户总共有30MB(不考虑inode)
限制,soft limit为25MB,宽限时间为2天.对群组考虑最大限额50MB.
1.新建用户组:#useradd test
#more /etc/passwd 知其gid为502
#useradd –m –g 502 test1
2.新建目录并挂载:#mkdir /mail(分区略)
#mkfs –t ext3 /dev/sdc1

  
3.开启磁盘的quota功能:#vi /etc/fstab


即在默认的defaults后加上“,usrquota,grpquota”
注:要使刚才的编辑生效,可以:
1.reboot  
2.remount filesystem  (reboot太麻烦 我用remount来使其生效:
# mount –a –o remount  
也可以这样:
#umount /dev/sdc1
# mount –a )
4.扫描磁盘使用情况并在/mail下生成aquota.user.auota.group

注:quotacheck可能会出现的问题:#quotacheck:Cannot get quotafile name for /dev/sdc1
#quotacheck:Cannot get quotafile name for /dev/sdc1
可以通过两个方法解决:1.加-m强制进行,即#quotacheck –uvgm
手动建立quotafile:touch /mail/aquota.user;touch /mail/aquota.group
5.启动quota:

6.编辑用户的quota: # edquota –u test



然后把这个配置复制给另一用户test1:


7.宽限时间的设定:
# edquota –t
即把默认的7天改为2天,下图:

至此用户的quota已搞定,接下来编辑组test的quota。
# edquota –g test
把soft和hard修改为50000、60000如下图:


大功告成!
四.总结:1.quota是针对当前目录以及其子目录,所以它的子目录当然也要受限制.另外当前目录的挂载点必须是独立的partition.
2.最好不要对/做quota,另外也不要对root做quota!
3.在quotacheck时,如果磁盘持续运作,则档案可能会有增减,造成扫描错误,因此在扫描时该磁盘将自动设定成read-only,,然后在磁盘最顶端生成aquota.***(就的linux版本为quota.***),若aquota.***已存在则更新它。另外新版的Linux distribution在quota上似乎存在点缺陷,有时无法完整的quotacheck,手动建立quotafile或加参数-m强制扫描即可。
               
               
               
               
               
               
               
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/1604/showart_1856932.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP