一、检查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。
本文出自 “一年后回头看看” 博客,请务必保留此出处http://cubix.blog.51cto.com/7251166/1840107
原文地址:http://cubix.blog.51cto.com/7251166/1840107