Solution to LVM volume group with the same name in Linux

Source: Internet
Author: User
A friend's server hard drive went wrong over the weekend. The IDC had an IDE hard drive mounted to install the system, and then the former SATA hard drive was mounted. he wanted to reset the data, as a result, the buddy found that he was not sure. He called me for help. I went up and looked at it remotely, and found that the two disk systems are all in the LVM partition format 8e, not the ext3 83. it's no wonder that he won't mount the disk and

A friend's server hard drive went wrong over the weekend. The IDC had an IDE hard drive mounted to install the system, and then the former SATA hard drive was mounted. he wanted to reset the data, as a result, the buddy found that he was not sure. He called me for help. I went up and looked at it remotely and found that the two disk systems are all in the LVM partition format 8e, not the ext3 83. it is no wonder that they will not be mounted, another problem is that the volume Group is installed with the same name VolGroup00 by default.

[Root @ locallhost ~] # Pvs
Pv vg Fmt AttrPSize PFree
/Dev/hda2 VolGroup00 lvm2 a-74.41G 0
/Dev/sda2 VolGroup00 lvm2. a-232.78G 0

Hda2 is a new system disk with more than 74G, and sda2 is an old data disk with more than 232G. The volume group name is the same, because both systems are installed by default.

[Root @ locallhost ~] # Vgs
VG # PV # LV # SN Attr VSize VFree
VolGroup00 1 2 0 wz-n-232.78G 0
VolGroup00 1 2 0wz-n-74.41G 0

We first use vgrename to change the volume Group name:

[Root @ locallhost ~] # Vgrename VolGroup00 aaalvm
Found more than one VG called VolGroup00. Please supply VGuuid.

Uuid is used to directly report the same name. You can use vgdisplay or vgs-v to check the uuid:

[Root @ locallhost ~] # Vgdisplay
--- Volume group ---
VGName VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 2
OpenLV 2
MaxPV 0
CurPV 1
ActPV 1
VGSize 232.78 GB
PESize 32.00 MB
TotalPE 7449
Alloc PE/Size 7449/232 .78 GB
Free PE/Size 0/0
VGUUID bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR 3Ct

--- Volume group ---
VGName VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 2
OpenLV 2
MaxPV 0
CurPV 1
ActPV 1
VGSize 74.41 GB
PESize 32.00 MB
TotalPE 2381
Alloc PE/Size 2381/74 .41 GB
Free PE/Size 0/0
YHLmkq-b1xS-UzAS-Y3nv-6vaX-2Xou-GScvk0 VGUUID

[Root @ locallhost ~] # Vgs-v
Finding all volume groups
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3 ).
Archiving volume group "VolGroup00" metadata (seqno 3 ).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3 ).
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3 ).
Archiving volume group "VolGroup00" metadata (seqno 3 ).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3 ).
VG Attr Ext # PV # LV # SNVSize VFree VG UUID
VolGroup00 wz -- n-32.00 M 1 2 0 232.78G 0 bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR 3Ct
VolGroup00 wz -- n-32.00 M 1 2 0 74.41G 0 YHLmkq-b1xS-UzAS-Y3nv-6vaX-2Xou-GScvk0

Check that the uuid of the data disk is bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR 3Ct. use uuid when changing the volume group name, as shown below:

[Root @ locallhost ~] # VgrenamebAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR 3Ct aaalvm
Volume group "VolGroup00" successfully renamed to "aaalvm"

OK. check the vgs after the change:

[Root @ locallhost ~] # Vgs
VG # PV # LV # SN Attr VSize VFree
VolGroup00 1 2 0wz-n-74.41G 0
Aaalvm 1 2 0 wz-n-232.78G 0

No problem.LvsCan:

[Root @ locallhost ~] # Lvscan
Inactive '/dev/aaalvm/logvol00' [228.84 GB] inherit
Inactive '/dev/aaalvm/LogVol01' [3.94 GB] inherit
ACTIVE '/dev/VolGroup00/logvol00' [70.47 GB] inherit
ACTIVE '/dev/VolGroup00/logvol01' [3.94 GB] inherit

Now we can see that the new volume Group is inactive, with two shards LogVol00 and LogVol01. use vgchange to load the named aaalvm volume group:

[Root @ locallhost ~] # Vgchange-ay/dev/aaalvm
2 logical volume (s) in volume group "aaalvm" now active

The system prompts that the active status is successful, and the file system is mounted:

[Root @ locallhost ~] # Ls/dev/aaalvm/
LogVol00 LogVol01
[Root @ locallhost ~] # Mount/dev/aaalvm/LogVol00/aaaa/
[Root @ locallhost ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/mapper/VolGroup00-LogVol00
69G 2.7G 63G 5%/
/Dev/hda1 99 M 12 M 82 M 13%/boot
Tmpfs 1010 M 0 1010 M 0%/dev/shm
/Dev/mapper/aaalvm-LogVol00
222G, 111G, 100G, 53%/aaaa
[Root @ locallhost ~] # Mount/dev/aaalvm/LogVol01/bbb/
/Dev/aaalvm/LogVol01 looks like swapspace-not mounted
Mount: you must specify the filesystem type

LogVol01 is a swap partition without mounting. Write/bin/mount/dev/aaalvm/LogVol00/aaaa/to rc. in the local file, you can enable automatic mounting at startup or write it to fstab. However, if an error occurs, the system may fail to be mounted. Therefore, it is recommended to write rc. local.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.