LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Adding an LVM hard disk to a system already running/using LVM (https://www.linuxquestions.org/questions/linux-hardware-18/adding-an-lvm-hard-disk-to-a-system-already-running-using-lvm-825219/)

firewiz87 08-09-2010 11:01 PM

Adding an LVM hard disk to a system already running/using LVM
 
I have two systems, both having file systems running on LVM.
System No 1 has 2 PATA HDD (40 and 80 GB) running linux on LVM.
System 2 has a single SATA HDD (300 GB) which again uses LVM. What i was trying to do was to add the two HDD in system 1 to system 2, possibly with little or no data loss.

So i connected the PATA drives from system 1 to system 2 and booted up. The system booted up to the openSUSE 11.3 splash screen and stopped after scanning the HDDs. Frankly i never expected openSUSE to try n auto mount the new drives.

I think the problem was caused because both the systems had VG and LV of the same names.

Any idea how to resolve this conflict? Can the volume group be renamed, maybe from a live CD or somthing?? System 2 is not boot able now.

Thanks in advance for your reply.

tlowk 08-10-2010 12:30 AM

I never tried this, but I would handle it like this

boot system1

use vgrename

check also the fstab to modify the device names that refer to the lv's

after this connect to system1

you can also use a live cd and use these commands as root

vgscan
vgchange -ay
vgrename oldname newname

vgchange -an

the vgchange -an without argument will deactivate all volumegroups wich shouldn't be a problem since you are running with a livecd

firewiz87 08-10-2010 02:18 AM

Quote:

Originally Posted by tlowk (Post 4061355)
I never tried this, but I would handle it like this

boot system1

use vgrename

check also the fstab to modify the device names that refer to the lv's

after this connect to system1

you can also use a live cd and use these commands as root

vgscan
vgchange -ay
vgrename oldname newname

vgchange -an

the vgchange -an without argument will deactivate all volumegroups wich shouldn't be a problem since you are running with a livecd

That is quite confusing... i think u mixed up the system numbers...

Also, will any live CD work?? Or is there a particular one i should try for this purpose??

tlowk 08-10-2010 02:25 AM

well you need the rename the volume group you will add to the other system, since that way that system will still work

I think you could try a knoppix cdrom, but others might also work.

maybe you will need to use

modprobe dm-mod # to enable the device mapper used for LVM

then just

vgscan
vgchange -ay
lvs
vgrename oldname newname
vgchange -an

after this you could reboot and see what happens if you repeat this until lvs

when you see it renamed connect the volume group to the other system

I hope this can help

firewiz87 08-11-2010 01:13 AM

Thank you for the help... I ll try it n let you know what happens.

firewiz87 08-15-2010 12:59 AM

I tried to follow the method. But since i did not have any Live CDs or access to the old system, i had to do it the hard way.Here is what i did:

1. Unplugged the 300GB HDD and booted system2.
2. Now i was booting into the volume group that i wanted to rename (the root partition is also an LV).This meant that i could not use the "vgrename" command since the VG was in use.
3. I took a metadata backup of the current VG (named system) using "vgcfgbackup" command to /etc/lvm/backup/system (file)
4. Edited the file changed the VG name in the file to "system1" and renamed the backup file to "system1".
5. Restored the edited metatdata backup file (system2) using the command "vgcfgrestore".
6. Edited the necessary files like fstab etc
7. Rebooted the system.

Thats it added a VG with the same name from another system with zero data loss. I did take a backup, just in case there was a worst case scenario.


All times are GMT -5. The time now is 01:16 AM.