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?
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 vgscan
lvm lvscan
lvm vgchange -a y
lvm pvscan
lvm lvscan
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!
i have the same problem but when i try these i get these errors;
# vgchange -a n
Can't deactivate volume group "VolGroup00" with 2 open logical volume(s)
Can't deactivate volume group "VolGroup00" with 2 open logical volume(s)
vgchange -a y
2 logical volume(s) in volume group "VolGroup00" now active
2 logical volume(s) in volume group "VolGroup00" now active
#vgrename UUID VolGroup01
Volume group "VolGroup00" still has active LVs
the main problem is the i have 2 hdd and i can't mount my old hdd. All of in the VolGroup00/LogVol00 . When i try to mount like that;
# mount /dev/VolGroup/LogVol00 /media/hdd
in /media/hdd i see my new hdd files and folder.
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.
Hi,
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.
Code:
#/sbin/vgscan
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
and
Code:
#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
nothing
# lvscan
# 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.
# exit
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.