Two LVM VolGroup's, same name, one is system disk - what to do?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Two LVM VolGroup's, same name, one is system disk - what to do?
hi, hope I've put this question in the right forum, not sure if this is more hardware or software...
I had a Fedora 4 install (my first linux build) which was working fine and then developed some networking issues (because i was playing with it too much), after a long story in another forum, I gave up on that and went for a new install!
having made a new installation on a different hard disk I thought it would be no problem to mount the old disk as well and use the data on it.
I didn't know then that LVM existed (yes I am very new to this stuff!) and LVM would not want two volume groups with the same name, and they have got the same name because thats what Fedora does by default (...when you know no better!)
the new disk is /dev/hda (with hda1 and 2), the old disk is /dev/hdc (1&2).
I found out that i should:
make a temporary copy of the /etc/lvm/lvm.conf file in a different directory and change the filter specified in that file to make vgscan find only the new hard disk. also set the new lvm.conf to create it's cache file in the new directory to check the results of the filter.
change the original lvm.conf to filter OUT the old hard disk.
then set environment variable LVM_SERVER_DIR to the temporary lvm directory's path.
then run vgscan so lvm sees the old drive as the VG
then use vgrename to change the name of the old disk's VG from VolGroup00 to VolGroup01 or something.
well I did all that and this is what I get:
Volgroup "VolGroup00" still has active LVs
...because vgscan doesnt use the temporary lvm.conf at all - i know because the .cache file is created in the original /etc/lvm directory every time and the contents of that file show that it has read the original lvm.conf file.
the info on changing LVM_SERVER_DIR comes from the lvm man page so i'm sure this is supposed to work. it just seems that the variable is being ignored, or LVM is incapable of looking at the temporary lvm directory
any suggestions where to go with this or another way I can access the data on the old disk?
It's a lot easier to rename the “old” volume group if the old drive is the only one connected to the system.
Using your first FC4 installation CD and with only the old drive installed, boot into rescue mode (boot: linux rescue), but don't search for or mount the FC installation. At the command prompt, you will probably need to active the lvm like this:
lvm vgchange -a y
The last two commands should list your volume group(s) and logical volume(s). Now use vgrename to fix the problem:
your detailed reply gave me everything I needed to know to get this done quickly, just the solution I've wanted for the past two days tearing my hair out trying to get one disk to ignore the other, etc.
in case anyone else needs the info, I had to issue the command:
lvm vgchange -a n
before the "lvm vgrename" command to deactivate the LVs.
then it's a matter of reconnecting both drives, rebooting to the new install and mounting the VG.
to mount the VG, after creating a directory "/mnt/oldhd/root" for a mount point i then had to use:
mount -t ext3 /dev/mapper/VolGroup01-LogVol00 /mnt/oldhd/root
to mount the VG. just thought I'd mention that bit about "/dev/mapper", cos it didn't seem obvious, or is that just me...
thanks and thanks again er, whatshisname...I might just be able to stick with this linux mullarkey long enough to get used to it!
Did you boot up with a rescue disk or a live disk. I would guess you are using Fedora Core so I would use the rescue disk.
Insert the drive that you want to rename and remove the one you don't. You just want to rename the Volume Group(VG) on the hard drive that you want to read from. You can then do it with the steps you tried earlier. vgchange vgrename vgchange
BTW renaming the (VG) on your root directory of the system you plan on booting with later will cause the system to kernel panic. However, you can rename it back after you are done copying data and it shouldn't be a problem
This seems like a recurring problem on forums. I've written a blog about it with several different solutions. Some of them have been inspired/taken from this thread.
I have two drives, both with Fedora 8 on them. One of them has some old data on it that I need to transfer to the new one.
I renamed the old drive's volume group to VolGroup01 and wanted to mount it, but there is no VolGroup01 in my /dev/mapper/ folder.
Here's some output, that VolGroup01 really exists and the command I used to mount it.
Reading all physical volumes. This may take a while...
Found volume group "VolGroup01" using metadata type lvm2
Found volume group "VolGroup00" using metadata type lvm2
#mount -t ext3 /dev/mapper/VolGroup01-LogVol00 /media/fullhd/root/
mount: special device /dev/mapper/VolGroup01-LogVol00 does not exist
You shouldn't have to boot from the recovery CD to run the "vgchange" command. You only need to unmount the filesystems that are in the volume group you are trying to rename. Of course if the volume group you are trying rename contains your root filesystem, then you would have to boot from the CD.
Remember that the "vgchange" command doesn't update your /etc/fstab file. Any VG name changes you make will also have to be manually changed in the /etc/fstab.
I found this thread when I had to rename a Volume Group. My extra (self inflicted) issue was that my root partition was a logical volume on the volume group that needed to be renamed. My system is running RHEL 5.5.
A few twists and turns were made. I would imagine that the lvrename steps could occur after the vgrename. But, I decided to document what worked for me and here it is:
Rename Logical Volumes and Volume Groups
current swap situation:
# swapon -s
# Filename Type Size Used Priority
# /dev/mapper/VolGroup00-LogVol01 partition 14319608 0 -2
turn off swap
# swapoff -a
# swapon -s
# ACTIVE '/dev/VolGroup00/root' [119.25 GB] inherit
# ACTIVE '/dev/VolGroup00/tmp' [2.94 GB] inherit
# ACTIVE '/dev/VolGroup00/swap1' [13.66 GB] inherit
Shutdown the server:
# shutdown -h now
Boot server into a linux rescue shell using the RHEL 5.5. installation DVD. (or possible an iso on a usb key?)
At the Red Hat splash screen and "boot:" prompt enter
# linux rescue
Answer a number of questions
1. Language: English [ OK ]
2. Keyboard: us [ OK ]
3. What type of Media contains the rescue media?: Local CDROM
[ OK ]
4. Do you want to start the Network Interfaces on this system?
[ NO ]
5. "Rescue" window. Offers to mount linux installation in rw, read only or not at all. Either way, we will be provided with a shell. As this system's root partition is on a logical volume in the volume group we wish to rename, we must not mount the system.
[ SKIP ]
A shell appears.
Scan for logical volumes:
# lvm vgscan
What you need to see is that the scan found the voloume group you wish to rename e.g.
# Found VolGroup00
Rename the volume group:
lvm vgrename VolGroup00 vg00
# Volume group "VolGroup00" successfully renamed to "vg00"
Exit the shell and reboot the server. Leave the RHEL Installation DVD in.
Go back into linux rescue mode
Answer questions 1 to 4 as above.
5. "Rescue" window, choose [ CONTINUE ] to mount system in read write mode. Eventually, a shell will appear. The system files are in /mnt/sysimage
chroot into the system:
# chroot /mnt/sysimage
Label logical volumes:
# e2label /dev/vg00/root /
# e2label /dev/vg00/tmp TMP
# mkswap -L SWAP1 /dev/mapper/vg00-swap1
# Setting up swapspace version 1, size = 14663282 kB
# LABEL=SWAP1, no uuid
Make a copy of /etc/fstab:
# cp -p /etc/fstab /etc/old/fstab.20100512