LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-22-2005, 09:55 PM   #1
ffingers
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
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?

they'd be so very much appreciated ......... ;-)
 
Old 10-23-2005, 01:26 AM   #2
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHEL, AltimaLinux, Rocky
Posts: 1,151

Rep: Reputation: 46
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:

lvm vgrename VolGroup00 whatever_you_want_to_call_it

Note that all lvm commands need to be preceded with “lvm” in rescue mode.
 
Old 10-23-2005, 09:52 AM   #3
ffingers
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Original Poster
Rep: Reputation: 0
THANKYOU!!!

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!

Last edited by ffingers; 10-23-2005 at 09:58 AM.
 
Old 10-23-2005, 05:01 PM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
And thank you ffingers for being so polite as to thank your helper as well as tell of the positive outcome.

Oh yes, & a few more points to you for posting a refinement on the fix, it may help the next person w/ the same problem.

Last edited by archtoad6; 03-26-2009 at 07:17 AM. Reason: minor typo
 
Old 11-26-2006, 11:29 PM   #5
jpyeron
LQ Newbie
 
Registered: Nov 2006
Posts: 1

Rep: Reputation: 0
using a live cd, with both drives in, I downed with
Code:
lvm vgchange -a n
and then issued a
Code:
vgrename UUID VolGroup01
ex:
Code:
vgrename T0Xg9i-11uz-Am7t-VbEj-sfhj-0WC6-PZSYhO VolGroup0
 
Old 12-27-2006, 02:45 AM   #6
embreu
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 0
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.

How can i mount my old hdd ???
 
Old 02-08-2007, 10:33 AM   #7
tlann75
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Rep: Reputation: 0
lvm conflicting Volume Group (VG) names

Embreu,

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.

http:\\technoeclectic.blogger.com

Last edited by tlann75; 02-08-2007 at 10:34 AM.
 
Old 09-23-2007, 02:24 AM   #8
wendel77
LQ Newbie
 
Registered: Sep 2007
Posts: 1

Rep: Reputation: Disabled
Wink

Thanks, I 've had the some problem ans I follow your instructions. Now it works great !
 
Old 12-12-2007, 12:11 AM   #9
helikart
LQ Newbie
 
Registered: Dec 2007
Posts: 1

Rep: Reputation: 0
cannot find VolGroup01

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
Any help would be greatly appreciated!

Thanks in advance!

Tom
 
Old 06-03-2008, 12:37 PM   #10
kah00na
LQ Newbie
 
Registered: Aug 2006
Posts: 7

Rep: Reputation: 0
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.
 
Old 03-25-2009, 07:45 AM   #11
kha
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
You can rename the conflicting VG by using the UUID for it

Instead of "vgrename VolGroup00 VolgroupOLD" use "vgrename <VG UUID> VolGroupOLD". You can see the UUID from "vgs -v".
 
Old 05-12-2010, 02:59 PM   #12
TechnoPeasant
LQ Newbie
 
Registered: May 2010
Location: Montreal, QC, Canada
Distribution: RHEL Slackware
Posts: 1

Rep: Reputation: 0
Post If root partition on the Volume group.

Hi there,

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

Rename the logical volumes:
# lvrename VolGroup00 LogVol00 root
# lvrename VolGroup00 LogVol01 swap1
# lvrename VolGroup00 LogVol02 tmp

Turn swap back on:
# swapon -a

# 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

Make sure logical volumes are inactive:
# lvm lvscan
# inactive '/dev/VolGroup00/root' [119.25 GB] inherit
# inactive '/dev/VolGroup00/tmp' [2.94 GB] inherit
# inactive '/dev/VolGroup00/swap1' [13.66 GB] inherit

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

Update fstab with correct Labels:
# vim fstab
# diff -uw /etc/old/fstab.20100507 /etc/fstab
# --- /etc/old/fstab.20100512 2010-04-13 03:45:12.000000000 -0400
# +++ /etc/fstab 2010-05-12 14:45:13.000000000 -0400
# @@ -1,8 +1,8 @@
# -/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
# -/dev/VolGroup00/LogVol02 /tmp ext3 defaults 1 2
# +LABEL=/ / ext3 defaults 1 1
# +LABEL=TMP /tmp ext3 defaults 1 2
# LABEL=/boot /boot ext3 defaults 1 2
# tmpfs /dev/shm tmpfs defaults 0 0
# devpts /dev/pts devpts gid=5,mode=620 0 0
# sysfs /sys sysfs defaults 0 0
# proc /proc proc defaults 0 0
# -/dev/VolGroup00/LogVol01 swap swap defaults 0 0
# +LABEL=SWAP1 swap swap defaults 0 0

Make a copy of grub.conf
cp -p /boot/grub/grub.conf /boot/grub/old/grub.conf.20100512

Update grub.conf with updated path to root partition and yet to be made
initrd file -> initrd-2.6.18-194.el5.vgrepair.img
# vim /boot/grub/grub.conf
# diff -uw /boot/grub/old/grub.conf.20100512 /boot/grub/grub.conf
# --- old/grub.conf.20100512 2010-05-03 11:39:36.000000000 -0400
# +++ grub.conf 2010-05-12 15:17:41.000000000 -0400
# @@ -4,7 +4,7 @@
# # NOTICE: You have a /boot partition. This means that
# # all kernel and initrd paths are relative to /boot/, eg.
# # root (hd0,0)
# -# kernel /vmlinuz-version ro
# root=/dev/VolGroup00/LogVol00
# +# kernel /vmlinuz-version ro root=/dev/vg00/root
# # initrd /initrd-version.img
# #boot=/dev/sda
# default=0
# @@ -13,5 +13,9 @@
# hiddenmenu
# title Red Hat Enterprise Linux Server (2.6.18-194.el5)
# root (hd0,0)
# - kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/root # rhgb quiet crashkernel=128M@16M
# + kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/vg00/root rhgb # quiet crashkernel=128M@16M
# + initrd /initrd-2.6.18-194.el5.vgrepair.img
# +title Red Hat Enterprise Linux Server (2.6.18-194.el5)
# + root (hd0,0)
# + kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/vg00/root rhgb # quiet crashkernel=128M@16M
# initrd /initrd-2.6.18-194.el5.img

Make a new initrd image - to match entry in grub.conf:
# mkinitrd /boot/initrd-2.6.18-194.el5.vgrepair.img 2.6.18-194.el5

This takes some time and there is no output.

Exit from shell:
# exit
and from linux rescue
# exit

System begins to reboot. When it has finished shutting down services, but before it begins to start them, remove the dvd.

At the menu choose the VG Repair kernel (or leave and let the system boot into the default)

Good luck,
TechnoPeasant
------------------
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM - adding a new scsi hard disk ddaas Red Hat 1 07-28-2005 02:13 AM
Restoring LVM when a disk fails enygma Linux - General 1 11-13-2004 07:58 AM
Suspend to Disk (Possible with LVM?) dino9832 Linux - Laptop and Netbook 1 10-05-2004 09:16 AM
remounting a lvm partitioned disk on new box seastar Linux - Software 5 01-21-2004 11:21 PM
Help with backup on an lvm system wlfdgcrkz Linux - Software 1 05-09-2003 11:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration