Linux LVM-删除卷组逻辑卷物理卷

查看卷组相关信息

[root@localhost /]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2

查看卷组VolGroup00包含的PV、LV信息。

[root@localhost /]# vgdisplay -v VolGroup00
    Using volume group(s) on command line
    Finding volume group "VolGroup00"
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.01 GiB
  PE Size               8.00 MiB
  Total PE              129
  Alloc PE / Size       100 / 800.00 MiB
  Free  PE / Size       29 / 232.00 MiB
  VG UUID               Cug510-pQb6-RELO-lb1K-zjbt-3f62-jQLoQp
   
  --- Logical volume ---
  LV Path                /dev/VolGroup00/iscsi00
  LV Name                iscsi00
  VG Name                VolGroup00
  LV UUID                tE78D6-5kJf-0HOh-4jRX-oLhI-ehyR-XhMmMQ
  LV Write Access        read/write
  LV Creation host, time localhost.iscsi, 2017-01-19 14:25:40 +0800
  LV Status              available
  # open                 0
  LV Size                800.00 MiB
  Current LE             100
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Physical volumes ---
  PV Name               /dev/sda7     
  PV UUID               OWz0uw-gTR1-WylF-z6HW-cgpe-LLd9-2W8Q9g
  PV Status             allocatable
  To编辑/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]: y
  Logical volume "iscsi00" successfully removed
[root@localhost /]# 

如果删除提示出错,那么检查下当前使用该逻辑卷的进程,然后结束该进程或者服务即可。

验证LV是否删除

[root@localhost /]# lvdisplay | grep "dev/VolGroup00/iscsi00"

删除卷组VG

[root@localhost /]# vgremove VolGroup00
  Volume group "VolGroup00" successfully removed
[root@localhost /]# 

如果采用安全的方式删除卷组VG,则必须使用 vgchange -a n VolGroup00 将其关闭,然后再删除它。

[root@localhost /]# vgchange -a n VolGroup00
  0 logical volume(s) in volume group "VolGroup00" now active
[root@localhost /]# vgremove VolGroup00
  Volume 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/sda7
  Labels on physical volume "/dev/sda7" successfully wiped
[root@localhost /]# pvscan
  No matching physical volumes found
[root@localhost /]#

编辑 /etc/fstab 删除对应挂载点信息

如果没有设置挂载点,可以忽略这一步,否则重启系统就会出现问题,切记!


以上就是LVM删除步骤了,如果使用该方法遇到问题,可以给我评论留言 :-D


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值