How To Rename a Volume Group in LVM
I needed to access an old disk from the same Linux desktop the other day, and realised it’s a bit problematic if both old and new disks were organised into LVM (Logical Volume Manager) VGs (volume groups) of exactly the same name.
When Multiple Volume Groups Have the Same Name
Here’s how it looked when I connected the second drive:
root@rhel8:~ # vgdisplay --- Volume group --- VG Name rhel System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 8 VG Access read/write VG Status resizable MAX LV 0 Cur LV 7 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 1.35 TiB PE Size 4.00 MiB Total PE 355124 Alloc PE / Size 355123 / 1.35 TiB Free PE / Size 1 / 4.00 MiB VG UUID mCcciI-zCpq-B5GB-RDiK-kn6J-53GQ-KtonSw --- Volume group --- VG Name rhel System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 8 VG Access read/write VG Status resizable MAX LV 0 Cur LV 7 Open LV 7 Max PV 0 Cur PV 1 Act PV 1 VG Size 930.51 GiB PE Size 4.00 MiB Total PE 238211 Alloc PE / Size 238209 / 930.50 GiB Free PE / Size 2 / 8.00 MiB VG UUID dYWq2M-sQ8n-8oco-glme-qe82-m456-FlHdx5
Rename Volume Group (VG) in LVM
root@rhel8:~ # vgrename mCcciI-zCpq-B5GB-RDiK-kn6J-53GQ-KtonSw redhat
Processing VG rhel because of matching UUID mCcciI-zCpq-B5GB-RDiK-kn6J-53GQ-KtonSw
Volume group “mCcciI-zCpq-B5GB-RDiK-kn6J-53GQ-KtonSw” successfully renamed to “redhat”
Here’s how things looked after renaming:
root@localhost:~ # vgdisplay
— Volume group —
VG Name redhat
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 7
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.35 TiB
PE Size 4.00 MiB
Total PE 355124
Alloc PE / Size 355123 / 1.35 TiB
Free PE / Size 1 / 4.00 MiB
VG UUID mCcciI-zCpq-B5GB-RDiK-kn6J-53GQ-KtonSw
— Volume group —
VG Name rhel
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 7
Open LV 7
Max PV 0
Cur PV 1
Act PV 1
VG Size 930.51 GiB
PE Size 4.00 MiB
Total PE 238211
Alloc PE / Size 238209 / 930.50 GiB
Free PE / Size 2 / 8.00 MiB
VG UUID dYWq2M-sQ8n-8oco-glme-qe82-m456-FlHdx5