RHCE6 Preperation (11) – Quota
2014-10-01 21:15
260 查看
Create quota for user alice and /home/alice, least/soft limit is 40K, when exceeding 80K, the system will display the exceeded the user quota.
1, check the kernel support the quota function,
[root@server4 home]# grep CONFIG_QUOTA /boot/config-2.6.32-358.6.1.el6.x86_64
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@server4 home]#
2, modify the /etc/fstab to activate the quota support for the /home folder,
[root@server4 home]# vim /etc/fstab
add 'usrquota' and 'grpquota'
/dev/mapper/vgsrv-home /home ext4 defaults,usrquota,grpquota 1 23, remount the file system, make the quota effective,
mount -o remount,usrquota,grpquota /home
4, use quotacheck command to generate the basic quota configuration file,
quotacheck -cugmv /home
5, activate the quota limitation,
quotaon /home
6, use edquota command to configure the quota limit to specific user,
[root@server4 home]# edquota -u alice
modify the content to:
Disk quotas for user alice (uid 1004):
Filesystem blocks soft hard inodes soft hard
/dev/mapper/vgsrv-home 80 40 80 12 0 0
here 40K as soft limit, 80K as hard limit.
7, use repquota to check the quota status,
[root@server4 home]# repquota /home
*** Report for user quotas on device /dev/mapper/vgsrv-home
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 37945 0 0 5 0 0
lucy -- 16 0 0 8 0 0
student -- 38337 0 0 226 0 0
mary -- 20 0 0 10 0 0
alice +- 80 40 80 7days 12 0 0
bobby -- 16 0 0 8 0 0
aclan -- 16 0 0 8 0 0
8, test the result,
[root@server4 home]# su - alice
[alice@server4 ~]$ dd if=/dev/zero of=file1 bs=1k count=50
dm-3: warning, user block quota exceeded.
50+0 records in
50+0 records out
51200 bytes (51 kB) copied, 0.00173795 s, 29.5 MB/s
here the file1 created successful, however there is a warning, if continue to create file, it will fail,
[alice@server4 ~]$ dd if=/dev/zero of=file2 bs=1k count=30
dm-3: write failed, user block limit reached.
dd: writing `file2': Disk quota exceeded
9+0 records in
8+0 records out
8192 bytes (8.2 kB) copied, 0.00401174 s, 2.0 MB/s
file2 still created successful, but already reached 80K, if create another 1K file file3,
[alice@server4 ~]$ dd if=/dev/zero of=file3 bs=1k count=1
dd: opening `file3': Disk quota exceeded
1, check the kernel support the quota function,
[root@server4 home]# grep CONFIG_QUOTA /boot/config-2.6.32-358.6.1.el6.x86_64
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@server4 home]#
2, modify the /etc/fstab to activate the quota support for the /home folder,
[root@server4 home]# vim /etc/fstab
add 'usrquota' and 'grpquota'
/dev/mapper/vgsrv-home /home ext4 defaults,usrquota,grpquota 1 23, remount the file system, make the quota effective,
mount -o remount,usrquota,grpquota /home
4, use quotacheck command to generate the basic quota configuration file,
quotacheck -cugmv /home
5, activate the quota limitation,
quotaon /home
6, use edquota command to configure the quota limit to specific user,
[root@server4 home]# edquota -u alice
modify the content to:
Disk quotas for user alice (uid 1004):
Filesystem blocks soft hard inodes soft hard
/dev/mapper/vgsrv-home 80 40 80 12 0 0
here 40K as soft limit, 80K as hard limit.
7, use repquota to check the quota status,
[root@server4 home]# repquota /home
*** Report for user quotas on device /dev/mapper/vgsrv-home
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 37945 0 0 5 0 0
lucy -- 16 0 0 8 0 0
student -- 38337 0 0 226 0 0
mary -- 20 0 0 10 0 0
alice +- 80 40 80 7days 12 0 0
bobby -- 16 0 0 8 0 0
aclan -- 16 0 0 8 0 0
8, test the result,
[root@server4 home]# su - alice
[alice@server4 ~]$ dd if=/dev/zero of=file1 bs=1k count=50
dm-3: warning, user block quota exceeded.
50+0 records in
50+0 records out
51200 bytes (51 kB) copied, 0.00173795 s, 29.5 MB/s
here the file1 created successful, however there is a warning, if continue to create file, it will fail,
[alice@server4 ~]$ dd if=/dev/zero of=file2 bs=1k count=30
dm-3: write failed, user block limit reached.
dd: writing `file2': Disk quota exceeded
9+0 records in
8+0 records out
8192 bytes (8.2 kB) copied, 0.00401174 s, 2.0 MB/s
file2 still created successful, but already reached 80K, if create another 1K file file3,
[alice@server4 ~]$ dd if=/dev/zero of=file3 bs=1k count=1
dd: opening `file3': Disk quota exceeded
相关文章推荐
- RHCE6 Preperation (10) - SMTP,NFS, boot parameter
- RHCE6 Preperation (4) - user/group, kernel install, ip_forward, printer, crontab
- RHCE 学习笔记(11) 日志, NTP
- RHCE6 Preperation (5) - ldap, NIS, NTP, setfacl, vsftp
- RHCE6 Preperation (2) - yum source and auto mount
- RHCE练习题 10-11. NFS服务 共享与挂载
- RHCE6 Preperation (3) - find & copy, lvm resize, swap partition create
- RHCE6 Preperation (6) - httpd, lvm, grep, ssh, nfs
- RHCE6 Preperation (9) - SMTP,MTA, shell script, ftp
- iReport 0.4.0 released! (October 11, 2004)
- Java_11_15课堂总结
- 一步步学习SPD2010--第八章节--理解工作流(11)--移除和删除工作流
- Flume学习11_Flume1.5.0的安装使用及传输数据到Hadoop2.2
- 设计模式:11.迪米特法则
- Wine 3.0 发布,支持 Android 图形驱动、Direct3D 11 | Linux 中国
- SMON: found rollback segment # 11 at address 67fd103c to take offline.
- 掀起C++ 11的神秘面纱
- 一步步学习SPD2010--第十一章节--处理母版页(11)--关键点
- The 11 advantages of Java -Why you choose this language
- NYOJ 11 奇偶数分离