zoukankan      html  css  js  c++  java
  • 磁盘配额

    启用quota:在fstab中修改

        /dev/xvda3    /home    ext3    defaults,usrquota,grpquota 1 1

    重新挂载:

        umount /home
        mount -a
        mount -o remount /home

    新建两个用户test test2:

        groupadd test
        useradd -m -g test test
        useradd -m -g test test2
        passwd test
        passwd test2

    扫瞄磁盘的使用者使用状况,并产生重要的 aquota.group 与 aquota.user:

        quotacheck -a

    启动配额:

        quotaon -aug
       
    修改配额:
       
        # edquota -u test
        Disk quotas for user test (uid 500):
          Filesystem                   blocks       soft       hard     inodes     soft     hard
          /dev/xvda3                      120        100        120         18       15       18
       
        filesystem:指定分区
        blocks:     当前用户已用的磁盘容量,这个是quota自动算出来的,不需要修改
        soft:       允许用户超过这个值,但必须在宽限时间内降回这个容量范围内
        hard:       绝对不能超过的上限
        inodes:     当前使用的inode数,也是quota自动计算的,不需要修改

    修改宽限时间:

        # edquota -t
        Grace period before enforcing soft limits for users:
        Time units may be: days, hours, minutes, or seconds
          Filesystem             Block grace period     Inode grace period
          /dev/xvda3                    1days                  1days

        宽限时间:在超过软极限,而没有超过硬极限所允许超过软极限的时间。

    查看配额报告

        [root@client ~]# repquota -a
        *** Report for user quotas on device /dev/xvda3
        Block grace time: 24:00; Inode grace time: 24:00
                                Block limits                File limits
        User            used    soft    hard  grace    used  soft  hard  grace
        ----------------------------------------------------------------------
        root      --   68660       0       0              5     0     0      
        test      -+      32     100     120             18    15    18  24:00
        test2     --      32     100     120              8     0     0 
           
       
    取消配额:

        quotaoff  -aug
       
    为组添加配额:edquota -g test


    参考:
    1. http://linux-vbird.bluedata.org/linux_base/0420quota.htm
    2. http://pdc2011.blog.51cto.com/4096890/1006019
    3. http://cworld.wikidot.com/adm:enable-file-system-quota-on-debian
    4. http://en.wikipedia.org/wiki/Disk_quota
  • 相关阅读:
    2thweek.training.c。链表典型题
    队列—summer training B.
    栈—summertraining#2.A题
    周题:UVa10736题。Foreign Exchange
    UVA_11877.第三次比赛C题:The Coco Cola
    uva10465 Homer Simpson(水题)
    uva348 Optimal Array Multiplication Sequence(DP)
    uva116 Unidirectional TSP(DP)
    uva 607 Scheduling Lectures(DP)
    uva11598 Optimal Segments(DP 求方案)
  • 原文地址:https://www.cnblogs.com/feisky/p/2708464.html
Copyright © 2011-2022 走看看