close
Quota 設定
1.準備好測試的環境,使用者與群組的建立:
[root@linux ~]# groupadd qgroup
[root@linux ~]# useradd -m -g qgroup orz1
[root@linux ~]# useradd -m -g qgroup orz2
[root@linux ~]# passwd orz1
[root@linux ~]# passwd orz2

2.在 /etc/fstab 裡頭增加了 usrquota, grpquota

[root@linux ~]#vi /etc/fstab

 LABEL=/nfs   /mnt/nfs     ext3    defaults,usrquota,grpquota  1 2

 3.重新 remount filesystem 來驅動設定值

[root@linux ~]# mount -o remount /mnt/nfs
4.掃瞄磁碟的使用者使用狀況,並產生重要的 aquota.group 與 aquota.user:
[root@linux ~]# quotacheck -avug
quotacheck: Scanning /dev/hdb1 [/disk2] done
quotacheck: Checked 3 directories and 4 files
[root@linux ~]# ll /mnt/nfs
-rw-------  1 root root  6144 Sep  6 11:44 aquota.group
-rw-------  1 root root  6144 Sep  6 11:44 aquota.user

 5.啟動 quota 的限額:

 [root@linux ~]# quotaon -avug
/dev/hdb1 [/mnt/nfs]: group quotas turned on
/dev/hdb1 [/mnt/nfs]: user quotas turned on

 

 注意:要看到上面有個 turned on 的出現,才是真的成功了!

 

6.編輯使用者的可使用空間

 [root@linux ~]# edquota -u orz1
Disk quotas for user quser1 (uid 502):
  Filesystem    blocks    soft    hard   inodes   soft   hard
  /dev/hdb1          0   45000   50000
       0      0      0

 

7.將 quser1 的設定直接複製給 quser2 吧

[root@linux ~]# edquota -p orz1 orz2
8.設定寬限時間,還是使用 edquota
[root@linux ~]# 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/hdb1                     1days                  7days

 9.使用 quota -v 來查詢:

[root@linux ~]# quota -vu orz1
Disk quotas for user or1 (uid 502):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/hdb1       0   45000   50000               0       0       0
10.編輯群組可使用的空間:
[root@linux ~]# edquota -g qgroup
Disk quotas for group qgroup (gid 502):
  Filesystem    blocks    soft    hard  inodes   soft   hard
  /dev/hdb1          0   80000   90000       0      0      0

[root@linux ~]# quota -vg qgroup
Disk quotas for group qgroup (gid 502):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/hdb1       0   80000   90000               0       0       0
11.利用 repquota 顯示更完整的 quota 結果報告:

 範例一:查閱系統內所有的具有 quota 的 filesystem 的限值狀態:
[root@linux ~]# repquota -av

 範例二:僅列出 user 與 group 的 quota 限值:
[root@linux ~]# repquota -aug

arrow
arrow
    全站熱搜

    奔騰兔 發表在 痞客邦 留言(0) 人氣()