系统管理09-磁盘管理综合测试题
磁盘管理综合测试题
实验需求:
1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
实验拓扑:
实验步骤:
[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd]1
[root@localhost ~]# pvcreate /dev/md5
Physical volume "/dev/md5" successfully created.
root@localhost ~]# vgcreate myvg /dev/md5
Volume group "myvg" successfully created
root@localhost ~]# lvcreate -L 5G -n mylv myvg
Logical volume "mylv" created.
root@localhost ~]# mkfs.xfs /dev/myvg/mylv
1:[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs/
2:[root@localhost httpd-2.2.17]# /usr/local/httpd/htdocs/bin/apachectl start
[root@localhost httpd-2.2.17]# lynx 192.168.1.155
[root@localhost htdocs]# vim index.html
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# systemctl stop firewalld.service
[root@localhost htdocs]# setenforce 0
3:[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs/
[root@localhost ~]# mount -a
[root@localhost ~]# vim /etc/fstab
dev/myvg/mylv /usr/local/httpd/htdocs xfs defaults,usrquota,grpquota 0 0
[root@localhost ~]# quotacheck -avug
root@localhost ~]# quotaon -a
/dev/mapper/myvg-mylv 0 81920 102400 100 80 100
[root@localhost ~]# quota -uvs yue
Disk quotas for user yue (uid 1001):
Filesystem space quota limit grace files quota limit grace
/dev/mapper/myvg-mylv
0K 81920K 100M 0 80 100
[root@localhost ~]# repquota -auvs
*** Report for user quotas on device /dev/mapper/myvg-mylv
Block grace time: 7days; Inode grace time: 7days
Space limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 0K 0K 0K 3 0 0
yue -- 0K 81920K 100M 0 80 100
*** Status for user quotas on device /dev/mapper/myvg-mylv
Accounting: ON; Enforcement: ON
Inode: #1027 (2 blocks, 2 extents)
[root@localhost ~]# setfacl -m u:yue:rwx /usr/local/httpd/htdocs/
[root@localhost ~]# getfacl /usr/local/httpd/htdocs/
getfacl: Removing leading '/' from absolute path names
# file: usr/local/httpd/htdocs/
# owner: root
# group: root
user::rwx
user:yue:rwx
[root@localhost ~]# su yue
[yue@localhost root]$ cd /usr/local/httpd/htdocs/
[yue@localhost htdocs]$ touch {1..110}.txt
touch: 无法创建"101.txt": 超出磁盘限额
touch: 无法创建"102.txt": 超出磁盘限额