查看卷组相关信息
[root@localhost /]# vgscanReading all physical volumes. This may take a while...Found volume group "VolGroup00" using metadata type lvm2
查看卷组VolGroup00包含的PV、LV信息。
[root@localhost /]# vgdisplay -v VolGroup00Using volume group(s) on command lineFinding volume group "VolGroup00"--- Volume group ---VG Name VolGroup00System ID Format lvm2Metadata Areas 1Metadata Sequence No 2VG Access read/writeVG Status resizableMAX LV 0Cur LV 1Open LV 0Max PV 0Cur PV 1Act PV 1VG Size 1.01 GiBPE Size 8.00 MiBTotal PE 129Alloc PE / Size 100 / 800.00 MiBFree PE / Size 29 / 232.00 MiBVG UUID Cug510-pQb6-RELO-lb1K-zjbt-3f62-jQLoQp--- Logical volume ---LV Path /dev/VolGroup00/iscsi00LV Name iscsi00VG Name VolGroup00LV UUID tE78D6-5kJf-0HOh-4jRX-oLhI-ehyR-XhMmMQLV Write Access read/writeLV Creation host, time localhost.iscsi, 2017-01-19 14:25:40 +0800LV Status available# open 0LV Size 800.00 MiBCurrent LE 100Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:0--- Physical volumes ---PV Name /dev/sda7 PV UUID OWz0uw-gTR1-WylF-z6HW-cgpe-LLd9-2W8Q9gPV Status allocatableTo编辑/etc/fstab,删除对应挂载信息tal PE / Free PE 129 / 29
卸载卷组上的逻辑卷LV
要卸载对应卷组VG的所有逻辑卷LV。从上面的信息可以看出对应的卷组VolGroup00只有/dev/VolGroup00/iscsi00这个逻辑卷LV
[root@localhost /]# umount /dev/VolGroup00/iscsi00
如果还用进程在使用对应逻辑卷的文件,就必须强制卸载挂接点(#df -Th 查看)。
删除逻辑卷LV
[root@localhost /]# lvremove /dev/VolGroup00/iscsi00
Do you really want to remove active logical volume iscsi00? [y/n]: yLogical volume "iscsi00" successfully removed
[root@localhost /]#
如果删除提示出错,那么检查下当前使用该逻辑卷的进程,然后结束该进程或者服务即可。
验证LV是否删除
[root@localhost /]# lvdisplay | grep "dev/VolGroup00/iscsi00"
删除卷组VG
[root@localhost /]# vgremove VolGroup00Volume group "VolGroup00" successfully removed
[root@localhost /]#
如果采用安全的方式删除卷组VG,则必须使用 vgchange -a n VolGroup00 将其关闭,然后再删除它。
[root@localhost /]# vgchange -a n VolGroup000 logical volume(s) in volume group "VolGroup00" now active
[root@localhost /]# vgremove VolGroup00Volume group "VolGroup00" successfully removed
[root@localhost /]#
验证卷组(VG)是否删除
[root@localhost /]# vgscan Reading all physical volumes. This may take a while...No volume groups found
[root@localhost /]#
删除物理卷PV
[root@localhost /]# pvremove /dev/sda7Labels on physical volume "/dev/sda7" successfully wiped
[root@localhost /]# pvscanNo matching physical volumes found
[root@localhost /]#
编辑 /etc/fstab 删除对应挂载点信息
如果没有设置挂载点,可以忽略这一步,否则重启系统就会出现问题,切记!
以上就是LVM删除步骤了,如果使用该方法遇到问题,可以给我评论留言 :-D