十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
成都创新互联专注于企业网络营销推广、网站重做改版、临潭网站定制设计、自适应品牌网站建设、H5高端网站建设、成都做商城网站、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为临潭等各大城市提供网站开发制作服务。
上面左边是我的个人 微 信,如需进一步沟通,请加 微 信。 右边是我的公众号“Openstack私有云”,如有兴趣,请关注。
上次有一台物理机装了PVE,由于当初规划没有规划好,在配置使用存储的时候出了问题,后面索性就重装,当重装后发现除了系统盘会格式化之外,其他原先的盘的分区信息还是存在,特别是残留了大量的lvm的信息,所以还是需要手工去干预处理。这里做一个记录。
按照一般的lvm删除lv vg pv的顺序,首先是删除vg下的lv ,再删除vg,最后删除pv ,但是一般情况下pve在使用过程中会产生大量的lv,所以在删除的时候,可以使用vgremove命令直接删除vg,会同时将vg下的lv删除。
重装完成后,pve节点会自己创建一个叫pve的vg ,除此之外的,都是原来残留的vg,如下所示:
root@pve:~# vgdisplay |more --- Volume group --- VG Name ceph-d910d1d3-3595-4c5a-93ed-579e4a0968b4 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID Ngu9qK-BILc-sY4K-BFLG-0ICd-k4Fp-5mVXpg --- Volume group --- VG Name ceph-3ab6b8cb-a06c-458f-9947-eaaf40fc0525 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID T8ReNU-YOdO-Bver-KdYe-NG1p-qoiv-T6tUO1 --- Volume group --- VG Name ceph-aa50bad9-b042-40bd-b060-438cddaf8ff2 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID Wnn3OH-X11z-TovS-VFxn-sbz7-btsH-jPbUUa --- Volume group --- VG Name ceph-38029056-30a1-4bb8-b94f-da32dde62217 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID IT06de-ABnj-yE07-4VFS-WqES-0cep-7j3O4I --- Volume group --- VG Name vg-sdb System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 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 32.00 GiB PE Size 4.00 MiB Total PE 8191 Alloc PE / Size 7696 / 30.06 GiB Free PE / Size 495 / 1.93 GiB VG UUID QDHI0E-K5Vd-DZ77-o6N9-JRGC-AezH-eIai7Q --- Volume group --- VG Name pvevg2 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 493 VG Access read/write VG Status resizable MAX LV 0 Cur LV 23 Open LV 7 Max PV 0 Cur PV 1 Act PV 1 VG Size 556.93 GiB PE Size 4.00 MiB Total PE 142573 Alloc PE / Size 140836 / 550.14 GiB Free PE / Size 1737 / 6.79 GiB VG UUID 0NWJ32-iGhh-jPU8-BwxZ-46Ie-5DDB-md0XFB --- Volume group --- VG Name ceph-18ccfe46-ab1a-44e4-9b5e-910d55679b2d System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID 6A7ViB-O1UM-sbBw-iCSn-RR3D-IA2o-Uf5nMW --- Volume group --- VG Name ceph-ca21f994-6ea2-4d97-9377-b71e1713089d System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 17 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 30.00 GiB PE Size 4.00 MiB Total PE 7679 Alloc PE / Size 7679 / 30.00 GiB Free PE / Size 0 / 0 VG UUID bBvYWE-skn5-lD6G-A0aa-HvC1-cufv-HPh69e --- Volume group --- VG Name pve System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 556.68 GiB PE Size 4.00 MiB Total PE 142509 Alloc PE / Size 138413 / 540.68 GiB Free PE / Size 4096 / 16.00 GiB VG UUID 3rZ2nK-8oci-O0gh-c6ac-1XXX-slCA-5kh4jZ
接下来删除除了pve以外的所有vg:
root@pve:~# vgremove ceph-d910d1d3-3595-4c5a-93ed-579e4a0968b4 Do you really want to remove volume group "ceph-d910d1d3-3595-4c5a-93ed-579e4a0968b4" containing 1 logical volumes? [y/n]: y Do you really want to remove and DISCARD active logical volume ceph-d910d1d3-3595-4c5a-93ed-579e4a0968b4/osd-block-8b281dbd-5dac-40c7-86a9-2eadcd9d876b? [y/n]: y Logical volume "osd-block-8b281dbd-5dac-40c7-86a9-2eadcd9d876b" successfully removed Volume group "ceph-d910d1d3-3595-4c5a-93ed-579e4a0968b4" successfully removed root@pve:~# root@pve:~# vgremove ceph-3ab6b8cb-a06c-458f-9947-eaaf40fc0525 Do you really want to remove volume group "ceph-3ab6b8cb-a06c-458f-9947-eaaf40fc0525" containing 1 logical volumes? [y/n]: y Do you really want to remove and DISCARD active logical volume ceph-3ab6b8cb-a06c-458f-9947-eaaf40fc0525/osd-block-7b89b395-2506-4997-a545-14eb1a5a029f? [y/n]: y Logical volume "osd-block-7b89b395-2506-4997-a545-14eb1a5a029f" successfully removed Volume group "ceph-3ab6b8cb-a06c-458f-9947-eaaf40fc0525" successfully removed root@pve:~# root@pve:~# vgremove -f ceph-aa50bad9-b042-40bd-b060-438cddaf8ff2 Logical volume "osd-block-c1ccede6-d03b-409b-952d-57fd702b08fd" successfully removed Volume group "ceph-aa50bad9-b042-40bd-b060-438cddaf8ff2" successfully removed root@pve:~# root@pve:~# vgremove -f ceph-38029056-30a1-4bb8-b94f-da32dde62217 Logical volume "osd-block-a2331e8c-907b-48dd-a053-071d0e1d88ca" successfully removed Volume group "ceph-38029056-30a1-4bb8-b94f-da32dde62217" successfully removed root@pve:~# vgremove -f vg-sdb Logical volume "lvm-sdb" successfully removed Volume group "vg-sdb" successfully removed root@pve:~# vgremove -f pvevg2 Logical volume "vm-112-disk-3" successfully removed Logical volume "vm-112-disk-4" successfully removed Logical volume "vm-111-disk-5" successfully removed Logical volume "vm-112-disk-5" successfully removed Logical volume "vm-113-disk-5" successfully removed Logical volume "vm-112-disk-7" successfully removed Logical volume "snap_vm-112-disk-2_pve52init1" successfully removed Logical volume "snap_vm-112-disk-6_pve52init1" successfully removed Logical volume "vm-111-state-pve52ceph2" successfully removed Logical volume "vm-113-state-pve52ceph2" successfully removed Logical volume "vm-111-state-pve52cephok" successfully removed Logical volume "vm-113-state-pve52cephok" successfully removed Logical volume pvevg2/vm-111-disk-2 is used by another device. root@pve:~# vgremove ceph-18ccfe46-ab1a-44e4-9b5e-910d55679b2d -f Logical volume "osd-block-7e68233c-97b2-4bd7-8d24-a48212e02943" successfully removed Volume group "ceph-18ccfe46-ab1a-44e4-9b5e-910d55679b2d" successfully removed root@pve:~# vgremove ceph-ca21f994-6ea2-4d97-9377-b71e1713089d -f Logical volume "osd-block-a489f6f9-e24d-408c-ada2-850dbe876c23" successfully removed Volume group "ceph-ca21f994-6ea2-4d97-9377-b71e1713089d" successfully removed root@pve:~#再次查看vg和pv情况:
root@pve:~# vgdisplay --- Volume group --- VG Name pve System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 556.68 GiB PE Size 4.00 MiB Total PE 142509 Alloc PE / Size 138413 / 540.68 GiB Free PE / Size 4096 / 16.00 GiB VG UUID 3rZ2nK-8oci-O0gh-c6ac-1XXX-slCA-5kh4jZ root@pve:~# root@pve:~# pvdisplay --- Physical volume --- PV Name /dev/sda3 VG Name pve PV Size 556.68 GiB / not usable 1.98 MiB Allocatable yes PE Size 4.00 MiB Total PE 142509 Free PE 4096 Allocated PE 138413 PV UUID 6LqVrb-YLWy-doYc-RMVR-XA58-6XuQ-sSVpwD "/dev/sdb1" is a new physical volume of "556.93 GiB" --- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 556.93 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID 45XFJa-Uixa-4zi7-2Bbe-LnEs-vRea-XAKjiB清理成功!
另外,记录一下,如果碰到一些lv像狗皮膏药一样怎么删都提示设备忙被占用的情况下怎么删除的方法。我参考了这个网址的内容:
http://blog.roberthallam.org/2017/12/solved-logical-volume-is-used-by-another-device/comment-page-1/
主要是用到了dmsetup这个更加底层的指令,主要步骤如下:
# lvremove -v /dev/vg/lv-old DEGRADED MODE. Incomplete RAID LVs will be processed. Using logical volume(s) on command line Logical volume vg/lv-old is used by another device. # dmsetup info -c | grep old vg-lv--old 253 9 L--w 1 2 1 LVM-6O3jLvI6ZR3fg6ZpMgTlkqAudvgkfphCyPcP8AwpU2H57VjVBNmFBpL Tis8ia0NE $ ls -la /sys/dev/block/253\:9/holders drwxr-xr-x 2 root root 0 Dec 12 01:07 . drwxr-xr-x 8 root root 0 Dec 12 01:07 .. lrwxrwxrwx 1 root root 0 Dec 12 01:07 dm-18 -> ../../dm-18 # dmsetup remove /dev/dm-18 # lvremove -v /dev/vgraid6/lv-old另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。