【Solaris】Solaris檔案系統管理6 磁碟配額管理

海星星hktk發表於2016-01-08
Solaris檔案系統管理6
磁碟配額管理



1 UFS檔案系統磁碟配額使用

1.1 使檔案系統支援配額功能

編輯/etc/vfstab檔案,在/export/home 掛載選項增加rq標記
[root@solaris188:/]#cp /etc/vfstab /etc/vfstab.bak
[root@solaris188:/]#vi /etc/vfstab        
/dev/dsk/c0t0d0s7  /dev/rdsk/c0t0d0s7  /export/home  ufs  2  yes  rq
[root@solaris188:/]#cat /etc/vfstab | grep rq


重新掛載檔案系統
[root@solaris188:/]#mount -o remount /export/home





1.2 在檔案系統根目錄建立配額檔案

使用root使用者,在/export/home下建立名為quotas的檔案,該檔案所有者為root,其他使用者不能對它進行寫操作。

[root@solaris188:/]#cd /export/home
[root@solaris188:/export/home]#touch quotas
[root@solaris188:/export/home]#chmod 600 quotas


1.3 對使用者做配額限制
編輯tom使用者配額項,使用i節點做限制
[root@solaris188:/]#edquota tom
fs /export/home blocks (soft = 0, hard = 0) inodes (soft = 10, hard = 15)


檢視tom的配額限制
[root@solaris188:/]#quota -v tom


對檔案系統開啟配額功能      (關閉使用quotaoff)
[root@solaris188:/]#quotaon -av /export/home


同步檔案系統配額,再次檢視tom配額情況
[root@solaris188:/export/home]#quotacheck -av /export/home
[root@solaris188:/export/home]#quota -v tom

當前檔案6,軟限制10,硬限制15

1.4 tom使用者建立新檔案


[tom@solaris188:/export/home/tom]$touch file1
[tom@solaris188:/export/home/tom]$touch file2
[tom@solaris188:/export/home/tom]$touch file3



[root@solaris188:/]#quota -v tom


即將達到軟限制,繼續建立檔案
[tom@solaris188:/export/home/tom]$touch file4

建立檔案達到軟限制時,會顯示warning,但仍可以繼續建立檔案。

[root@solaris188:/]#quota -v tom

繼續建立檔案,達到應限制時報錯,不能建立
[tom@solaris188:/export/home/tom]$touch file5
[tom@solaris188:/export/home/tom]$touch file6
[tom@solaris188:/export/home/tom]$touch file7
[tom@solaris188:/export/home/tom]$touch file8
[tom@solaris188:/export/home/tom]$touch file9



[root@solaris188:/]#quota -v tom


1.5 複製磁碟配額設定

將tom配置複製給bob
[root@solaris188:/]#edquota -p tom bob
[root@solaris188:/]#quota -v bob


檢視檔案系統上使用者配額使用情況
[root@solaris188:/]#repquota -av


修改預設計時器 (不會影響當前的配額違反者)
[root@solaris188:/]#edquota -t
fs /export/home blocks time limit = 2 weeks, files time limit = 16 day

bob使用者建立檔案超過軟限制
[bob@solaris188:/export/home/bob]$touch file1 file2 file3 file4 file5


[root@solaris188:/]#repquota -av


1.6 關閉磁碟配額
[root@solaris188:/]#quotaoff -av /export/home

刪除配額檔案
[root@solaris188:/export/home]#rm quotas


2 開啟/關閉 ZFS磁碟配額

檢視當前檔案系統
[root@solaris188:/]#zfs list


檢視磁碟配額屬性
[root@solaris188:/]#zfs get quota


設定testpool/home/sandy配額為300m
[root@solaris188:/]#zfs set quota=300m testpool/home/sandy
[root@solaris188:/]#zfs list
[root@solaris188:/]#zfs get quota


取消對testpool/home/sandy的配額限制
[root@solaris188:/]#zfs set quota=none testpool/home/sandy
[root@solaris188:/]#zfs list
[root@solaris188:/]#zfs get quota







呂星昊
2016.1.8

?

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29475508/viewspace-1973841/,如需轉載,請註明出處,否則將追究法律責任。

相關文章