1.查看磁盘
root@ps-VMware-Virtual-Platform:~# lsblk
2.创建磁盘分区并设置磁盘分区代码为8e(逻辑卷代码)
root@ps-VMware-Virtual-Platform:~# fdisk /dev/sdb
3.创建pv
root@ps-VMware-Virtual-Platform:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
4.查看pv
root@ps-VMware-Virtual-Platform:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 lvm2 --- 5.00g 5.00g
5.创建vg
root@ps-VMware-Virtual-Platform:~# vgcreate vmtest /dev/sdb1
Volume group "vmtest" successfully created
6.查看vg
root@ps-VMware-Virtual-Platform:~# vgs
VG #PV #LV #SN Attr VSize VFree
vmtest 1 0 0 wz--n- <5.00g <5.00g
7.创建lv
root@ps-VMware-Virtual-Platform:~# lvcreate -n vmtest1 -L 5G vmtest
Volume group "vmtest" has insufficient free space (1279 extents): 1280 required.
这里磁盘容量给满会报错
root@ps-VMware-Virtual-Platform:~# lvcreate -n vmtest1 -L 5G vmtest
Volume group "vmtest" has insufficient free space (1279 extents): 1280 required.
8.查看lv
root@ps-VMware-Virtual-Platform:~# lvcreate -n vmtest1 -L 4.9G vmtest
Rounding up size to full physical extent 4.90 GiB
Logical volume "vmtest1" created.
9.逻辑卷创建完成