一、檢查quota是否安裝:
[root@localhost ~]# rpm -qa | grep quota
quota-3.13-1.2.5.el5
二、檢查、配置磁盤掛載選項
1.配置quota前
[root@localhost ~]# cat /etc/fstab |grep sdc
UUID="d6c99ad6-0c55-46e8-b9ac-68e19c3c3c12" /sdc ext2 defaults 1 1
[root@localhost ~]# mount |grep /dev/sdc
/dev/sdc on /sdc type ext2 (rw)
2.修改quota配置
[root@localhost ~]# cat /etc/fstab |grep sdc
UUID="d6c99ad6-0c55-46e8-b9ac-68e19c3c3c12" /sdc ext2 defaults, usrquota,grpquota 1 1
[root@localhost ~]# umount /dev/sdc
[root@localhost ~]# mount -a (無報錯即可成功掛載。)
[root@localhost ~]# mount |grep /sdc
/dev/sdc on /sdc type ext2 (rw, usrquota,grpquota )
三、創建用戶、組,配置磁盤限額
1.創建用戶、組
[root@localhost ~]# groupadd share
[root@localhost ~]# useradd user1 -g share
2.創建配額文件
[root@localhost sdc]# quotacheck -cumg /sdc
[root@localhost sdc]# ls
aquota.group aquota.user lost+found
3.創建用戶配額
shell命令創建
[root@localhost sdc]# setquota -u user1 102400 102400 0 0 /sdc
軟限制容量50M,硬限制100M,限制300個文件、目錄,
edquota創建(類似vi)
[root@localhost sdc]# edquota -u user1
Disk quotas for user user1 (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/sdc 0 102400 102400 0 300 500
4.開啟配額
[root@localhost sdc]# quotaon -avug
/dev/sdc [/sdc]: group quotas turned on
/dev/sdc [/sdc]: user quotas turned on
四、smb配置
[root@localhost samba]# tail smb.conf
; writable = yes
; printable = no
; write list = +staff
[sdc]
comment = sdc
path = /sdc/share
public = no
writable = yes
guest ok = no
valid users = user1
五、驗證
①在windows上映射磁盤,顯示分區為100M
②在Linux上掛載,顯示為共享磁盤的原始容量。
但是測試往磁盤寫200M數據,只能成功寫入100M。
©著作權歸作者所有:來自51CTO博客作者cy_lyh的原創作品,如需轉載,請註明出處,否則將追究法律責任
資料來源: https://blog.51cto.com/cubix/1840107
沒有留言:
張貼留言