Linux学习实例,请各位知道---对用户的管理配额
2013-10-16 23:05
495 查看
对用户的磁盘配额
使用虚拟机 添加一块20G硬盘
[root@localhost ~]# fdisk -l
[root@localhost ~]# fdisk /dev/sdb (创建一个主分区sdb1,ext3)
[root@localhost ~]# partprobe /dev/sdb
[root@localhost ~]# mkfs.ext3 /dev/sdb1
[root@localhost ~]# mkdir /mail //建立挂载点
[root@localhost ~]# echo '/dev/sdb1 /mail ext3 defaults,usrquota 0 0' >> /etc/fstab //配置分区/dev/sdb1支持配额
[root@localhost ~]# mount -a // 挂载/etc/fstab 中默认的挂载项或reboot
[root@localhost ~]# mount | grep sdb1
/dev/sdb1 on /mail type ext3 (rw,usrquota)
[root@localhost ~]# ls /mail/
lost+found
[root@localhost ~]# quotacheck -uc /dev/sdb1 //生成配额文件
[root@localhost ~]# ls /mailbox/
aquota.user lost+found
[root@localhost ~]# edquota -u tom //配置对tom的配额信息
Disk quotas for user tom (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 0 80000 100000 0 4 6
[root@localhost ~]# ls -ld /mail/
drwxr-xr-x 3 root root 4096 10-16 22:24 /mail/
[root@localhost ~]# quota -u /dev/sdb1
[root@localhost ~]# chown tom /mail/ //将tom改为/mail/目录的所有者
[root@localhost ~]# ls -ld /mail/
drwxr-xr-x 3 tom root 4096 10-16 22:24 /mail/
[root@localhost ~]# su - tom //切换到tom验证
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=60
60+0 records in
60+0 records out
62914560 bytes (63 MB) copied, 0.367778 seconds, 171 MB/s
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=90
sdb1: warning, user block quota exceeded.
90+0 records in
90+0 records out
94371840 bytes (94 MB) copied, 0.298712 seconds, 316 MB/s
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=120
sdb1: warning, user block quota exceeded.
sdb1: write failed, user block limit reached.
dd: 写入 “/mail/test.db”: 超出磁盘限额
98+0 records in
97+0 records out
102289408 bytes (102 MB) copied, 0.267445 seconds, 382 MB/s
[tom@localhost ~]$ touch /mail/test.txt
[tom@localhost ~]$ touch /mail/test1.txt
[tom@localhost ~]$ touch /mail/test2.txt
sdb1: warning, user file quota exceeded.
[tom@localhost ~]$ touch /mail/test3.txt
[tom@localhost ~]$ touch /mail/test4.txt
sdb1: write failed, user file limit reached.
touch: 无法触碰 “/mail/test4.txt”: 超出磁盘限额
[tom@localhost ~]$ ls /mail/
aquota.user lost+found test1.txt test2.txt test3.txt test.db test.txt
[tom@localhost ~]$ ls -l /mail/
总计 100020
-rw------- 1 root root 7168 10-16 22:34 aquota.user
drwx------ 2 root root 16384 10-16 22:12 lost+found
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test1.txt
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test2.txt
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test3.txt
-rw-rw-r-- 1 tom tom 102289408 10-16 22:35 test.db
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test.txt
使用虚拟机 添加一块20G硬盘
[root@localhost ~]# fdisk -l
[root@localhost ~]# fdisk /dev/sdb (创建一个主分区sdb1,ext3)
[root@localhost ~]# partprobe /dev/sdb
[root@localhost ~]# mkfs.ext3 /dev/sdb1
[root@localhost ~]# mkdir /mail //建立挂载点
[root@localhost ~]# echo '/dev/sdb1 /mail ext3 defaults,usrquota 0 0' >> /etc/fstab //配置分区/dev/sdb1支持配额
[root@localhost ~]# mount -a // 挂载/etc/fstab 中默认的挂载项或reboot
[root@localhost ~]# mount | grep sdb1
/dev/sdb1 on /mail type ext3 (rw,usrquota)
[root@localhost ~]# ls /mail/
lost+found
[root@localhost ~]# quotacheck -uc /dev/sdb1 //生成配额文件
[root@localhost ~]# ls /mailbox/
aquota.user lost+found
[root@localhost ~]# edquota -u tom //配置对tom的配额信息
Disk quotas for user tom (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 0 80000 100000 0 4 6
[root@localhost ~]# ls -ld /mail/
drwxr-xr-x 3 root root 4096 10-16 22:24 /mail/
[root@localhost ~]# quota -u /dev/sdb1
[root@localhost ~]# chown tom /mail/ //将tom改为/mail/目录的所有者
[root@localhost ~]# ls -ld /mail/
drwxr-xr-x 3 tom root 4096 10-16 22:24 /mail/
[root@localhost ~]# su - tom //切换到tom验证
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=60
60+0 records in
60+0 records out
62914560 bytes (63 MB) copied, 0.367778 seconds, 171 MB/s
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=90
sdb1: warning, user block quota exceeded.
90+0 records in
90+0 records out
94371840 bytes (94 MB) copied, 0.298712 seconds, 316 MB/s
[tom@localhost ~]$ dd if=/dev/zero of=/mail/test.db bs=1M count=120
sdb1: warning, user block quota exceeded.
sdb1: write failed, user block limit reached.
dd: 写入 “/mail/test.db”: 超出磁盘限额
98+0 records in
97+0 records out
102289408 bytes (102 MB) copied, 0.267445 seconds, 382 MB/s
[tom@localhost ~]$ touch /mail/test.txt
[tom@localhost ~]$ touch /mail/test1.txt
[tom@localhost ~]$ touch /mail/test2.txt
sdb1: warning, user file quota exceeded.
[tom@localhost ~]$ touch /mail/test3.txt
[tom@localhost ~]$ touch /mail/test4.txt
sdb1: write failed, user file limit reached.
touch: 无法触碰 “/mail/test4.txt”: 超出磁盘限额
[tom@localhost ~]$ ls /mail/
aquota.user lost+found test1.txt test2.txt test3.txt test.db test.txt
[tom@localhost ~]$ ls -l /mail/
总计 100020
-rw------- 1 root root 7168 10-16 22:34 aquota.user
drwx------ 2 root root 16384 10-16 22:12 lost+found
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test1.txt
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test2.txt
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test3.txt
-rw-rw-r-- 1 tom tom 102289408 10-16 22:35 test.db
-rw-rw-r-- 1 tom tom 0 10-16 22:37 test.txt
相关文章推荐
- 轻松学习Linux之用户账户管理及实例
- 轻松学习Linux之用户账户管理及实例
- 轻松学习Linux之用户账户管理及实例
- Linux学习笔记:用户的权限管理
- 一天一点学习Linux之用户(user)和用户组(group)管理
- [linux学习笔记]第2天:时间管理,命令帮助信息,文本查看,权限及用户管理,BASH和变量,脚本
- Linux学习笔记:用户管理和权限控制
- Linux学习笔记之 7 Linux用户账号管理
- Centos学习笔记--linux用户管理
- Linux——用户管理简单学习笔记(一)
- Linux——用户管理简单学习笔记(二)
- 【Linux学习笔记】十一、用户和用户组管理
- Linux学习日志day2 Part1——搭建freeIPA服务器实现用户管理以及SSH服务远程登录
- Linux系统命令及Shell脚本学习笔记二:用户管理
- Linux学习日记 —— 7.4 用户和用户组管理-用户组管理命令
- RedHat学习 linux用户管理命令(添加,删除,修改)
- 菜鸟学习linux笔记与练习-----第一天。一些初级命令以及基本用户管理
- linux系统管理学习笔记之四---用户管理
- linux学习(十一)用户和用户组管理
- Linux中用户管理详解-Linux学习日记