1.首先需要更改vg uuid的lvm不能处于激活状态
[root@localhost ~]# vgimportclone --basevgname centos /dev/sda2
Device /dev/sda2 has active LVs, deactivate first.
2.使用vgscan得到物理磁盘的路径
[root@localhost ~]# pvscan
PV /dev/sdb2 VG vg011 lvm2 [<499.00 GiB / 4.00 MiB free]
PV /dev/sda2 VG centos lvm2 [<499.00 GiB / 4.00 MiB free]
Total: 2 [997.99 GiB] / in use: 2 [997.99 GiB] / in no VG: 0 [0 ]
3.先用vgrename给磁盘重新改一个vgname,再使用vgimportclone命令为需要更改的磁盘重新生成vg uuid
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <499.00 GiB
PE Size 4.00 MiB
Total PE 127743
Alloc PE / Size 127742 / 498.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID dEgXW8-PsYd-1t6H-JNu5-sgcg-2K3l-EwXMtc
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size <499.00 GiB
PE Size 4.00 MiB
Total PE 127743
Alloc PE / Size 127742 / 498.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID YIk6Ds-MsxE-mwek-1x3S-uzdT-lxUo-VFxnGs
[root@localhost ~]# vgrename dEgXW8-PsYd-1t6H-JNu5-sgcg-2K3l-EwXMtc vg01
Processing VG centos because of matching UUID dEgXW8-PsYd-1t6H-JNu5-sgcg-2K3l-EwXMtc
Volume group "dEgXW8-PsYd-1t6H-JNu5-sgcg-2K3l-EwXMtc" successfully renamed to "vg01"
[root@localhost ~]# vgimportclone --basevgname vg01 /dev/sdb2
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name vg011
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <499.00 GiB
PE Size 4.00 MiB
Total PE 127743
Alloc PE / Size 127742 / 498.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID 36WT7t-8KVJ-dGjV-cmfA-qV6W-Wqgp-YSw2NG
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size <499.00 GiB
PE Size 4.00 MiB
Total PE 127743
Alloc PE / Size 127742 / 498.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID YIk6Ds-MsxE-mwek-1x3S-uzdT-lxUo-VFxnGs
4.最后激活lvm并挂载到挂载点就可以拷数据了
标签:PV,UUID,更改,VG,dev,LV,root,localhost From: https://www.cnblogs.com/ippondo/p/18410135