1.为主机增加80G SCSI 接口硬盘
磁盘 /dev/sdb:85.9 GB, 85899345920 字节,167772160 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
2.划分三个各20G的主分区
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41945087 20971520 83 Linux
/dev/sdb2 41945088 83888127 20971520 83 Linux
/dev/sdb3 83888128 125831167 20971520 83 Linux
3.将三个主分区转换为物理卷(pvcreate),扫描系统中的物理卷
[root@localhost ~]# pvcreate /dev/sdb{1..3}
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdb2" successfully created.
Physical volume "/dev/sdb3" successfully created.
磁盘 /dev/sdb:85.9 GB, 85899345920 字节,167772160 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
2.划分三个各20G的主分区
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41945087 20971520 83 Linux
/dev/sdb2 41945088 83888127 20971520 83 Linux
/dev/sdb3 83888128 125831167 20971520 83 Linux
3.将三个主分区转换为物理卷(pvcreate),扫描系统中的物理卷
[root@localhost ~]# pvcreate /dev/sdb{1..3}
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdb2" successfully created.
Physical volume "/dev/sdb3" successfully created.
[root@localhost ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<39.00 GiB / 4.00 MiB free]
PV /dev/sdb2 lvm2 [20.00 GiB]
PV /dev/sdb1 lvm2 [20.00 GiB]
PV /dev/sdb3 lvm2 [20.00 GiB]
Total: 4 [<99.00 GiB] / in use: 1 [<39.00 GiB] / in no VG: 3 [60.00 GiB]
4.使用两个物理卷创建卷组,名字为myvg,查看卷组大小
[root@localhost ~]# vgcreate myvg /dev/sdb{1,2}
Volume group "myvg" successfully created
[root@localhost ~]# vgscan
Reading volume groups from cache.
Found volume group "myvg" using metadata type lvm2
Found volume group "centos" using metadata type lvm2
5.创建逻辑卷mylv,大小为30G
[root@localhost ~]# lvcreate -L 30G -n mylv myvg
Logical volume "mylv" created.
6.将逻辑卷格式化成xfs文件系统,并挂载到/data目录上,创建文件测试
[root@localhost ~]# mkfs.xfs /dev/myvg/mylv
[root@localhost ~]# mkdir /data
[root@localhost ~]# mount /dev/myvg/mylv /data
[root@localhost ~]# echo "121234">/data/text.txt
7.增大逻辑卷到35G
[root@localhost ~]# lvextend -L +5G /dev/myvg/mylv
Size of logical volume myvg/mylv changed from 30.00 GiB (7680 extents) to 35.00 GiB (8960 extents).
Logical volume myvg/mylv successfully resized.
[root@localhost ~]# xfs_growfs /dev/myvg/mylv
[root@localhost ~]# lvdisplay /dev/myvg/mylv
LV Size 35.00 GiB
[root@localhost ~]# df -hT
/dev/mapper/myvg-mylv xfs 35G 33M 35G 1% /data
8.编辑/etc/fstab文件挂载逻辑卷,并支持磁盘配额选项
PV /dev/sda2 VG centos lvm2 [<39.00 GiB / 4.00 MiB free]
PV /dev/sdb2 lvm2 [20.00 GiB]
PV /dev/sdb1 lvm2 [20.00 GiB]
PV /dev/sdb3 lvm2 [20.00 GiB]
Total: 4 [<99.00 GiB] / in use: 1 [<39.00 GiB] / in no VG: 3 [60.00 GiB]
4.使用两个物理卷创建卷组,名字为myvg,查看卷组大小
[root@localhost ~]# vgcreate myvg /dev/sdb{1,2}
Volume group "myvg" successfully created
[root@localhost ~]# vgscan
Reading volume groups from cache.
Found volume group "myvg" using metadata type lvm2
Found volume group "centos" using metadata type lvm2
5.创建逻辑卷mylv,大小为30G
[root@localhost ~]# lvcreate -L 30G -n mylv myvg
Logical volume "mylv" created.
6.将逻辑卷格式化成xfs文件系统,并挂载到/data目录上,创建文件测试
[root@localhost ~]# mkfs.xfs /dev/myvg/mylv
[root@localhost ~]# mkdir /data
[root@localhost ~]# mount /dev/myvg/mylv /data
[root@localhost ~]# echo "121234">/data/text.txt
7.增大逻辑卷到35G
[root@localhost ~]# lvextend -L +5G /dev/myvg/mylv
Size of logical volume myvg/mylv changed from 30.00 GiB (7680 extents) to 35.00 GiB (8960 extents).
Logical volume myvg/mylv successfully resized.
[root@localhost ~]# xfs_growfs /dev/myvg/mylv
[root@localhost ~]# lvdisplay /dev/myvg/mylv
LV Size 35.00 GiB
[root@localhost ~]# df -hT
/dev/mapper/myvg-mylv xfs 35G 33M 35G 1% /data
8.编辑/etc/fstab文件挂载逻辑卷,并支持磁盘配额选项
9.创建磁盘配额,crushlinux用户在/data目录下文件大小软限制为80M,硬限制为100M,
crushlinux用户在/data目录下文件数量软限制为80个,硬限制为100个。
crushlinux用户在/data目录下文件数量软限制为80个,硬限制为100个。
10.使用touch dd 命令在/data目录下测试
11.查看配额的使用情况:用户角度