LVM删除(移除)
创建LVM流程:
pvcreate创建pv -> vgcreate创建卷组 -> lvcreate创建逻辑卷 -> mkfs.xfs lv 格式化-> mount挂载
删除LVM流程:
umount卸载 -> lvremove lv移出卷组中所有逻辑卷-> vgremove vg移出卷组-> pvremove 移出pv
[root@xuegod63 ~]# umount /lv01 #卸载逻辑卷
[root@xuegod63 ~]# lvremove /dev/vg01/lv01 #移除逻辑卷lv01
Do you really want to remove active logical volume vg01/lv01? [y/n]: y
Logical volume "lv01" successfully removed
[root@xuegod63 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv02 vg01 -wi-a----- 16.00m #已经看不到lv01
[root@xuegod63 ~]# vgremove vg01 #直接移除卷组vg01
Do you really want to remove volume group "vg01" containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume vg01/lv02? [y/n]: y
#如果卷组中还有lv,移出时,会提示,是否也移出,咱们这里直接移出
Logical volume "lv02" successfully removed
Volume group "vg01" successfully removed
[root@xuegod63 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg02 1 0 0 wz--n- 1008.00m 1008.00m #没有vg01
[root@xuegod63 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 lvm2 --- 1.00g 1.00g
/dev/sdb2 vg02 lvm2 a-- 1008.00m 1008.00m
/dev/sdb3 lvm2 --- 1.00g 1.00g
/dev/sdb4 lvm2 --- 1.00g 1.00g
[root@xuegod63 ~]# pvremove /dev/sdb1 #移出物理卷pv sdb1
Labels on physical volume "/dev/sdb1" successfully wiped.
[root@xuegod63 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb2 vg02 lvm2 a-- 1008.00m 1008.00m
/dev/sdb3 lvm2 --- 1.00g 1.00g
/dev/sdb4 lvm2 --- 1.00g 1.00g