Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1802317
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: LINUX

2007-03-13 08:31:58

                            QUOTA配置案例(on RHEL4)
   
    要求:本例对用户read实行磁盘配额限制,soft限制为4M,硬限制为5M
    前提:/home分区应该是单独分区
 
    1.编辑/etc/fstab中的分区对应的参数,在defaults后加“,usrquota,grpquota";
 
      LABEL=/home    /home          ext3    defaults,usrquota       1   2
 
    2.重新挂载/home分区或重启机器;
     
      mount -o remount /home (常用这个方法)
   
    3.建立硬盘配额文件

      quotacheck -cug /home
     
      这时在/home目录下生成一个aquota.user文件
   
    4.打开硬盘配额
 
     quotaon /home
 
    5.配置硬盘配额

     edquota read

  说明:soft,hard中单位为k,例如下例中,soft限制为4M,硬限制为5M.

Disk quotas for user read (uid 502):
  Filesystem   blocks       soft       hard     inodes     soft     hard
  /dev/hda7     11          4096       5120       10        0        0

   6.测试

    soft限制测试(在文件大小不大于5M前提下都应该没有问题)

    [root@test ~]# su - read
    [read@test ~]$ dd swapfs bs=4M count=1
     (生成一个4M大小的文件)
    [read@test ~]$ dd swapfs bs=4M count=1
     hda7: warning, user block quota exceeded.
      1+0 records in
      1+0 records out
    [read@test ~]$ du -sh *
     4.1M    swapfs

    hard限制测试(在文件大小不大于5M前提下都应该没有问题)
     
    
[read@test ~]$ rm swapfs
    [read@test ~]$ dd swapfs bs=5M count=1
     hda7: warning, user block quota exceeded.
     hda7: write failed, user block limit reached.
                                                                                      dd: writing `standard output': Disk quota exceeded
1+0 records in
0+0 records out   

     这个例子是没有考虑用户本身的配置文件,如: .bash_profile等文件的大小,总共可用5M,配置文件当然占一小部分,再生成一个5M的文件自然就会出错.

 


    

   
    

阅读(1060) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~