当前位置:
首页 > 笔记 > CentOS下删除一个卷组(VG)

CentOS下删除一个卷组(VG)

在Linux系统中,如何删除一个卷组(VG)呢? 下面我总结了一下如何删除卷组(VG)的具体步骤,仅供参考,如有不足,敬请指出。谢谢!在下面的例子中,我想删除卷组Xvdbgroup。
步骤1: 查看卷组(VG)相关信息,如下所示

[root@MyServer ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/vg_have-lv_root
8.5G 2.2G 5.9G 28% /
tmpfs 1.9G 60K 1.9G 1% /dev/shm
/dev/xvda1 485M 71M 389M 16% /boot
/dev/mapper/Xvdbgroup-xvdb1
138G 188M 131G 1% /home
[root@MyServer ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "Xvdbgroup" using metadata type lvm2
Found volume group "vg_have" using metadata type lvm2

查看卷组Xvdbgroup包含的PV、LV信息。如下所示

[root@MyServer ~]# vgdisplay -v Xvdbgroup
Using volume group(s) on command line
Finding volume group "Xvdbgroup"
--- Volume group ---
VG Name Xvdbgroup
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 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 139.99 GiB
PE Size 4.00 MiB
Total PE 35838
Alloc PE / Size 35812 / 139.89 GiB
Free PE / Size 26 / 104.00 MiB
VG UUID JtQNGg-LpQ1-1TGF-tD6U-uURC-taqJ-zly32E

--- Logical volume ---
LV Path /dev/Xvdbgroup/xvdb1
LV Name xvdb1
VG Name Xvdbgroup
LV UUID 5Fk8XE-nXJd-ZwQE-Xot4-tgdl-4VIy-xevz0Y
LV Write Access read/write
LV Creation host, time MyCloudServer, 2017-02-10 11:34:05 +0800
LV Status available
# open 1
LV Size 139.89 GiB
Current LE 35812
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Physical volumes ---
PV Name /dev/xvdb1
PV UUID LhFpTm-0VAz-W1D5-d5f5-A5Yi-xZtp-K0pYXP
PV Status allocatable
Total PE / Free PE 35838 / 26

2:卸载卷组的逻辑卷LV

要卸载对应卷组VG的所有逻辑卷LV。从上面的信息可以看出对应的卷组Xvdbgroup只有/dev/Xvdbgroup/xvdb1这个逻辑卷LV

[root@MyServer ~]# umount /dev/Xvdbgroup/xvdb1

3:删除逻辑卷LV

[root@MyServer ~]# lvremove /dev/Xvdbgroup/xvdb1
Do you really want to remove active logical volume xvdb1? [y/n]: y
Logical volume "xvdb1" successfully removed

验证LV是否删除

[root@MyServer ~]# lvdisplay | grep "dev/Xvdbgroup/xvdb1"

4:删除卷组VG

[root@MyServer ~]# vgremove Xvdbgroup
Volume group "Xvdbgroup" successfully removed

验证卷组(VG)是否删除

[root@MyServer ~]# vgscan

5:删除物理卷PV

[root@MyServer ~]# pvremove /dev/xvdb1
Labels on physical volume "/dev/xvdb1" successfully wiped
[root@MyServer ~]# pvscan
PV /dev/xvda2 VG vg_have lvm2 [9.51 GiB / 0 free]
Total: 1 [9.51 GiB] / in use: 1 [9.51 GiB] / in no VG: 0 [0 ]

CentOS下删除一个卷组(VG):等您坐沙发呢!

发表评论

表情
还能输入210个字