[root@linuxidc ~]# pvcreate /dev/sdb{1,2,3}
Device /dev/sdb1. not found (or ignored by filtering).
Physical volume "/dev/sdb2" successfully created
Physical volume "/dev/sdb3" successfully created
##我们一次创建了三个pv,分别为/dev/sdb1 /dev/sdb2 /dev/sdb3
[root@linuxidc ~]# pvscan
PV /dev/sdb2 lvm2 [30.00 GiB]
PV /dev/sdb3 lvm2 [30.00 GiB]
PV /dev/sdb1 lvm2 [30.00 GiB]
Total: 3 [90.00 GiB] / in use: 0 [0 ] / in no VG: 3 [90.00 GiB]
## 显示pv的基本信息,总共pv大小,vg已经使用pv大小,剩余pv的大小
[root@linuxidc ~]# pvdisplay ##显示pv的详细信息
"/dev/sdb2" is a new physical volume of "30.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb2 ##pv的名称
VG Name ##没有被分配所以显示空白
PV Size 30.00 GiB ##pv容量大小
Allocatable NO #是否被分配
PE Size 0 #PE的大小
Total PE 0 已分配出去PE大小
Free PE 0 空闲PE大小
Allocated PE 0 #剩下可用PE大小
PV UUID bmWNn0-7PND-2yVL-TGT7-U9mf-Du01-ERq7FY#pv的id号
##由于PE是在啊VG创建的时候才会指定各种的大小,所以此次大不分都显示0
"/dev/sdb3" is a new physical volume of "30.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb3
VG Name
PV Size 30.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sRE2ko-dd80-RxF3-zTGi-OMFH-z1AD-KFN0cL
"/dev/sdb1" is a new physical volume of "30.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 30.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 67mTD7-OroO-n5iK-GWBQ-Mqow-BYzi-HXraKm
三、创建VG
创建 VG 相关的命令:
vgcreate -s 大小 VG名 pv名(创建的时候可以指定PE大小)
vgcreate :就是主要创建 VG 的命令
vgscan :搜寻系统上面是否有 VG ,vgs显示简要信息
vgdisplay :显示目前系统上面的 VG 状态
vgextend :扩展VG
vgreduce :在 VG 内移除 PV
vgchange :配置 VG 是否启动 (active)
vgremove :删除一个 VG
[root@linuxidc ~]# vgcreate vg0 /dev/sdb{1,2,3}
Volume group "vg0" successfully created
[root@linuxidc ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg0 3 0 0 wz--n- 89.99g 89.99g
[root@linuxidc ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg0" using metadata type lvm2
[root@linuxidc ~]# vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 89.99 GiB##VG总共的大小90G(我pv每个大小30G)
PE Size 4.00 MiB ##每个PE的大小为4MB
Total PE 23037
Alloc PE / Size 0 / 0
Free PE / Size 23037 / 89.99 GiB
VG UUID p8dacU-UFYP-eazU-Jelp-vRAN-wEP3-hxzXfW
四、创建LVM
LVM创建相关命令:
lvcreate :创建 LV
lvscan :查询系统上面的
lvdisplay :显示系统上面的 LV 状态啊
lvextend :扩展容量
lvreduce :减少容量
lvremove :删除一个 LV