实验需求:
![](https://i-blog.csdnimg.cn/blog_migrate/c1efa489403ce87e7e51d525cbddcccc.png)
[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 ~]# 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 ~]# 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://i-blog.csdnimg.cn/blog_migrate/d9839fc1fa9cc4de8cc2a008fda7489d.png)