作业六

实验需求:

1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
 实验拓扑:
1:对三块硬盘进行分区

[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x138bba89 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x138bba89

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 83 Linux

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x149ab9d1 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x149ab9d1

设备 Boot Start End Blocks Id System
/dev/sdc1 2048 41943039 20970496 83 Linux

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xabc6f89f 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xabc6f89f

设备 Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 83 Linux

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。

2:创建MD5

[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd]
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: partition table exists on /dev/sdb
mdadm: partition table exists on /dev/sdb but will be lost or
meaningless after creating array
mdadm: partition table exists on /dev/sdc
mdadm: partition table exists on /dev/sdc but will be lost or
meaningless after creating array
mdadm: partition table exists on /dev/sdd
mdadm: partition table exists on /dev/sdd but will be lost or
meaningless after creating array
mdadm: size set to 20954112K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.

 

[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 39G -n mylv myvg
Logical volume "mylv" created.

 

[root@localhost ~]# mkfs -t ext4 /dev/myvg/mylv
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
2555904 inodes, 10223616 blocks
511180 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2157969408
312 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

 
[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs
[root@localhost ~]# vim /etc/fstab
 

[root@localhost ~]# cd /usr/local/httpd/htdocs
[root@localhost htdocs]# vim index.html
[root@localhost htdocs]# systemctl stop firewalld
[root@localhost htdocs]# setenforce 0

[root@localhost htdocs]# /usr/local/httpd/bin/apachectl start

[root@localhost htdocs]# lynx 127.0.0.1

 Exiting via interrupt: 2

[root@localhost htdocs]# useradd -d /usr/local/httpd/htdocs/Roomc liu
 

[root@localhost ~]# quotacheck -avug
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/mapper/myvg-mylv [/usr/local/httpd/htdocs] done
quotacheck: Checked 7 directories and 6 files
[root@localhost ~]# quotaon -aug
[root@localhost ~]# edquota -u liu
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# edquota -u liu
[root@localhost ~]# chmod -R 777 /usr/local/httpd/htdocs
chmod: 更改"/usr/local/httpd/htdocs/aquota.user" 的权限: 不允许的操作
chmod: 更改"/usr/local/httpd/htdocs/aquota.group" 的权限: 不允许的操作
[root@localhost ~]# su - liu
[liu@localhost ~]$ touch Roomc-liu
[liu@localhost ~]$ ll
总用量 0
-rw-rw-r--. 1 liu liu 0 8月 5 17:19 Roomc-liu
[liu@localhost ~]$ dd if=/dev/zero of=./Roomc-liu bs=1M count=90
dm-3: warning, user block quota exceeded.
记录了90+0 的读入
记录了90+0 的写出
94371840字节(94 MB)已复制,2.02693 秒,46.6 MB/秒

 
 
 
 
 
 
 
 
 
 

 

转载于:https://www.cnblogs.com/cxm123123form/p/11304308.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值