Solve the Problem of duplicate names of lvm partitions mounted to CentOS
Today, a friend has a problem with the server hard disk. After a new hard disk is installed and the system is installed, the problem occurs when the old hard disk is mounted,
In linux, use a new hard disk to install the system. After the system is installed, mount the original hard disk. The partition format is all the default partitions of the system.
It is in lvm format, and the default volume is VolGroup00. Well, you can understand the cause of the problem. let's solve this problem.
Use pvs to view the following information:
- [Root @ localhost ~] # Pvs
- PVVGFmtAttrPSizePFree
- /Dev/sda2VolGroup00lvm2a-372.50G0
- /Dev/sdb2VolGroup00lvm2a-136.62G0
I found that I can identify two VG correctly, but I have the same name. How can I mount it?
The solution is to rename the original VG and mount it after resolving the conflict.
Rename: vgrename VolGroup00 VolGroup01
The following message is displayed:
- [Root @ localhost ~] # VgrenameVolGroup00VolGroup01
- FoundmorethanoneVGcalledVolGroup00.PleasesupplyVGuuid.
The reason is that there are two VolGroup00 instances. The modified method prompts you to specify the VG uuid.
Run the following command to view the VG uuid:
- [Root @ localhost ~] # Vgs-v
- Findingallvolumegroups
- Findingvolumegroup "VolGroup00"
- Findingvolumegroup "VolGroup00"
- VGAttrExt # PV # LV # SNVSizeVFreeVGUUID
- VolGroup00wz -- n-32.00M120372.50G0dcHa6G-abU2-Xfq8-EPBm-jBLj-sf18-O5uH0U
- VolGroup00wz -- n-32.00M120136.62G0OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9
After the VG uuid is found, rename it again:
- [Root @ localhost ~] # VgrenameOF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9VolGroup01
- Volumegroup "VolGroup00" stillhasactiveLVs
After the modification is successful, run: lvscan
- [Root @ localhost ~] # Lvscan
- Inactive '/dev/VolGroup01/logvol00' [130.84 GB] inherit
- Inactive '/dev/VolGroup01/LogVol01' [1.94 GB] inherit
- ACTIVE '/dev/VolGroup00/logvol00' [367.09 GB] inherit
- ACTIVE '/dev/VolGroup00/logvol01' [5.41 GB] inherit
The modified VolGroup01 is inactive.
Use vgchange to load VolGroup01
- [Root @ localhost ~] # Vgchange-ay/dev/VolGroup01
- 2 logicalvolume (s) involumegroup "VolGroup01" nowactive
Run: lvscan
- [Root @ localhost ~] # Lvscan
- ACTIVE '/dev/VolGroup01/logvol00' [134.69 GB] inherit
- ACTIVE '/dev/VolGroup01/logvol01' [1.94 GB] inherit
- ACTIVE '/dev/VolGroup00/logvol00' [367.09 GB] inherit
- ACTIVE '/dev/VolGroup00/logvol01' [5.41 GB] inherit
VolGroup01 is ACTIVE.
Last mount
- [Root @ localhost ~] # Mount/dev/VolGroup01/LogVol00/data/www
Now, all are completed.