经过前几次文章的发表,感觉,用实验表格的方式做出来,可能效果更好一点,现在从这一次开始,使用这种模式
试验时间
|
2011-3-29
15:27
|
实验人
|
|
实验名称
|
Linux
磁盘配额
|
所属模块
及课程
|
版主自学
|
实验目的
|
验证磁盘配额
|
实验拓扑
|
暂无
|
实验步骤
|
1
、磁盘分区格式化的过程省略了,这都不懂的话,就别提掌握了
2
、[root@localhost /]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-hda3 swap swap defaults 0 0
/dev/hdd5 /hdd5 ext3 defaults,usrquota,grpquota 1 1
/dev/hdb5 /hdb5 ext3 defaults,usrquota,grpquota 1 1
[LU1]
3
、[root@localhost /]# cd /hdb5
[root@localhost hdb5]# ll
总计 16
drwx------ 2 root root 16384 03-29 15:49 lost+found
[LU2]
4
、[root@localhost ~]# quotacheck -cmug /dev/hdb5
[root@localhost ~]# cd /hdb5
[root@localhost hdb5]# ll
总计 32
-rw------- 1 root root 6144 03-29 16:26 aquota.group
-rw------- 1 root root 6144 03-29 16:26 aquota.user
[LU3]
drwx------ 2 root root 16384 03-29 16:06 lost+found
5
、[root@localhost ~]# useradd student
[LU4]
[root@localhost ~]# passwd student
Changing password for user student.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# setquota student 2140 5120 5 10 /dev/hdb5
[LU5]
[root@localhost ~]# su -l student
[student@localhost ~]$ cd /hdb5
[student@localhost hdb5]$ ls
aquota.group aquota.user lost+found
[student@localhost hdb5]$ mkdir test
[student@localhost hdb5]$ cd test/
[student@localhost test]$ ls
[student@localhost test]$ touch file
[student@localhost test]$ cd ..
[student@localhost hdb5]$ cd ..
[student@localhost /]$ dd if=/dev/zero of=/hdb5/test/file bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.070236 seconds, 14.9 MB/s
[student@localhost /]$ dd if=/dev/zero of=/hdb5/test/file bs=1M count=3
hdb5: warning, user block quota exceeded
[LU6]
.
3+0 records in
3+0 records out
3145728 bytes (3.1 MB) copied, 0.136958 seconds, 23.0 MB/s
[student@localhost /]$ ls -lh /hdb5/test/file
-rw-rw-r-- 1 student student 3.0M 03-31 08:35 /hdb5/test/file
[student@localhost /]$ dd if=/dev/zero of=/hdb5/test/file bs=1M count=6
hdb5: warning, user block quota exceeded.
hdb5: write failed, user block limit reached.
dd:
写入 “/hdb5/test/file”: 超出磁盘限额
[LU7]
5+0 records in
4+0 records out
5226496 bytes (5.2 MB) copied, 0.207516 seconds, 25.2 MB/s
[student@localhost /]$ ls -lh /hdb5/test/file
-rw-rw-r-- 1 student student 5.0M 03-31 08:36 /hdb5/test/file
[LU8]
[student@localhost /]$ cd /hdb5
[student@localhost hdb5]$ ls
aquota.group aquota.user lost+found test
[student@localhost hdb5]$ cd test/
[student@localhost test]$ ls
file
[student@localhost test]$ touch 1 2 3 4
hdb5: warning, user file quota exceeded
[LU9]
.
[student@localhost test]$ touch 5
[student@localhost test]$ touch 6 7 8
[student@localhost test]$ touch 9
[LU10]
hdb5: write failed, user file limit reached.
touch:
无法触碰 “9”: 超出磁盘限额
[student@localhost test]$ touch 10
touch:
无法触碰 “10”: 超出磁盘限额
[student@localhost test]$ ls
1
2 3 4 5 6 7 8 file
[LU11]
[student@localhost test]$ quota student
Disk quotas for user student (uid 502):
Filesystem blocks quota limit grace files quota limit grace
/dev/hdb5 5120* 2140 5120 6days 10* 5 10 6days
[LU12]
[root@localhost ~]# repquota -a
*** Report for user quotas on device /dev/hdb5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 17692 0 0 4 0 0
student ++
[LU13]
5120 2140 5120 6days 10 5 10 6days
[LU14]
6
、
|