2

I had a CentOS 5.5 server with two drives in it (sda, sdb) using LVM. sda had a combination of physical partitions and LVs. sdb had one volume group named data with multiple logical volumes. There were no logical volumes or volume groups that spanned the two disks.

Last week I decided to reinstall the OS including formatting /, /root, /boot and rebuilding the LVs on sda. sdb was not touched during the reinstallation as it contains all of the data I want to keep.

After the installation the physical volume on sdb was not listed as active by LVM. Running (as best I can tell from looking at my history) pvscan activated the physical volume. Unfortunately, none of the existing volume groups on sdb were being listed.

I then ran vgcreate data /dev/sdb which I thought would either give errors reporting an existing volume group existed with this name or would somehow activate the data volume group. Unfortunately for me, neither of these things happened.

At this point I haven't touched anything on /dev/sdb since I would like to recover the existing logical volumes that are defined on that drive. Is there anyway to reactivate those volumes?

2 Answers 2

2

If you had a backup of /etc/lvm/backup/data or perhaps even /etc/lvm/archive/data_* from before the reinstall it would help a great deal. You could use vgcfgrestore with the old config to rebuild the VG.

At any point before the vgcreate, you could probably have run vgscan and "vgchange -a y" to activate data and get it running again.

Now that you ran vgcreate, the options are more limited... I am assuming that vgs now shows an empty data VG.

Another option, if you happen to know the exact layout of the volumes on /dev/sdb, it is possible to create LVs in those exact positions and sometimes mount filesystems that are there... but it's tricky and I wouldn't want to do it unless I had no other choice, because the PEs have to be used in the exact same order.

2
  • Yeah vgs shows an empty data VG. It looks like I'm out of luck as I don't know the exact PE order
    – Chris Gow
    Feb 28, 2011 at 21:41
  • marking this answer as my accepted answer as it seems closest to what I would need to do, if I actually followed the correct migration steps
    – Chris Gow
    Feb 28, 2011 at 21:41
0

If you've somehow ended up with two volume groups with the same name, use vgrename to rename one of them. In your situation the two volume groups should have distinct UUIDs, and you can pass a UUID to vgrename to make sure it acts on the desired group.

Now, if I understand your question correctly, you now have two volume groups, A (new) and B (old), and you have some logical volumes in B that you'd like to be in A. First run vgscan and perhaps vgchange -ay to make sure all your volume groups are active. Then run vgmerge to merge the two volume groups into one, or vgsplit to move some physical volumes from B to A.

If this doesn't help, please post the output of pvs, lvs and vgdisplay.

2
  • I've updated the question giving more background.
    – Chris Gow
    Feb 15, 2011 at 1:59
  • The logical volumes in B were created before the reinstall but are not being recognized in the new install. I'm guessing that the LVs are referencing the old UUID of volume group B
    – Chris Gow
    Feb 17, 2011 at 2:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .