quota (www mail file) ---针对分区,不针对文件夹,内核须支持!!!
[root@localhost ~]# mkfs.ext3 -Lpart1/dev/sdb1
[root@localhost ~]# mount -o remount,rw,usrquota,grpquota /dev/sdb1 /media/ (未挂载的就无需remount)
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# quotacheck -avug 生成记录文件aquota.group aquota.user(已有旧的,或删或 -Mf覆盖)
[root@localhost ~]# ls /media/ 在支持quota功能的分区里(上面mount时加上的)
aquota.group aquota.user lost+found (若生成不了这俩文件,手工touch两空文件照用)
[root@localhost ~]# quotaon -u /media/ 启用quota
[root@localhost ~]# quotaon -g /media/
[root@localhost ~]# useradd xuhe
[root@localhost ~]# passwd xuhe
[root@localhost ~]# chmod 777 /media/
[root@localhost ~]# edquota -u xuhe 针对用户xuhe设置quota
[root@localhost ~]# su - xuhe (上:可用# setquota -u xuhe 0 0 2 3 /media/ 来设置)
[xuhe@localhost ~]$ cd /media/
[xuhe@localhost media]$ ls
aquota.group aquota.user lost+found
[xuhe@localhost media]$ touch a
[xuhe@localhost media]$ touch b
[xuhe@localhost media]$ touch c
sdb1: warning, user file quota exceeded. 超出限额
[xuhe@localhost media]$ touch d 确认sendmail在运行
sdb1: write failed, user file limit reached. 执行warnquota (发超限邮件)
touch: 无法触碰 “d”: 超出磁盘限额
[xuhe@localhost media]$ ls
a aquota.group aquota.user b c lost+found
[xuhe@localhost media]$quota -u 查看(root用repquota -a)
Disk quotas for user xuhe (uid 500): 需先进/media/下写点东西,空的是查看不出来的!!
Filesystem blocks quota limit grace files quota limit grace(宽限时间)
/dev/sdb1 0 0 0 3* 2 3 7days