quota服务

468阅读 0评论2011-06-15 ccjsj1_cu
分类:LINUX

1、 启用quota功能

vi /etc/fstab在跟行编辑如下

/dev/VolGroup00/LogVol00  /  ext3  defaults,grpquota,usrquota  1  1

       mount –o remount /

 

2、 创建quota文件

cd /

touch aquota.user aquota.group

quotacheck –avug –m

 

 

3、 创建test1用户并设置磁盘限额

useradd test1 && echo 123456 | passwd test1 --stdin

edquota –u test1 编辑如下(blocksinodes不修改,只修改softhard

Disk quotas for user test1 (uid 500):

  Filesystem  blocks   soft       hard    inodes   soft    hard

  /dev/mapper/VolGroup00-LogVol00

                      0       500000    500000  3       100    100

 

4、 开机启动磁盘限额

vi /etc/rc.d/rc.local 加入下面行

              quotaon –au

              然后重启系统

 

5、 确认test1用户的磁盘限额生效

test1用户身份创建1G文件,确认文件大小不能超过500

dd if=/dev/zero of=bigfile bs=1M count=1024

test1用户身份创建100个文件,确认文件数量不能超过100个(当前目录还有其他默认文件)

for FILE in `seq 1 100` ; do touch $FILE; done

 
文件: 4a-user_add.rar
大小: 0KB
下载: 下载
文件: 4a-user_del.rar
大小: 0KB
下载: 下载
上一篇:时区之 CST UTC GMT ETA
下一篇:使用logrotate管理Linux日志(转)