[linux-lvm] vg disappeared after replacing disc in raid10

Björn Nadrowski bjrnfrdnnd at gmail.com
Wed Mar 27 23:39:35 UTC 2013

I recovered my data. 
Thanks for all your help. 
The problem was in fact knoppix, but not because it had an older version of lvm2 or even lvm1.

The problem was that the human-readable part I extracted from the beginning of the device contained invisible characters in front of the 
'vol0' label in the file 'volt.txt' .
These characters were not visible in terminal using 'cat', 'more', and they also did not appear in standard error as a consequence of the 'vgcfgrestore' command, as witnessed by the first line of the error:

'data/vol0.txt' does not contain volume group 'vol0'.

The reason why I could not observe this problem under knoppix is, that I did not use any other programs to display text than 'cat', 'more', standard error/standard out, and libreoffice. So I could not see that there were these invisible characters in front of 'vol0'.
Under knoppix, I did not have xemacs, which I usually use, so I could not locate the problem, thinking that my restore file vol0.txt was ok.
This belief was reinforced by the fact that I could use the file without problems to recreate the physical volume using pvcreate with the uuid switch.

You helped me finding the problem because of your comments on possible lvm2-version differences between ubuntu and knoppix, so I redid the whole thing with a ubuntu live cd, where I could install xemacs, and I noticed the characters. 
I could then remove the bogey volume group that I had created from scratch using vgremove, and after that, the
vgcfgrestore command with the corrected file vol0.txt worked without problems. 

Right now I am doing my backup, before switching the faulty drive to the new replacement… This is not gonna happen again.

Something during the replacement happened that did something with the metadata for the physical volume. I do not know what that was.  
The human-readable metadata at the beginning of the raid10 device was still there and intact.
I copied the data from the beginning of the raid10 device using 

sudo dd if=/dev/md127 bs=512 count=255 skip=1 of=md0.txt

Then copied the volume group description from md0.txt to a file called vol0.txt.

I could then recreate the physical volume using 

sudo pvcreate --uuid WFo1On-anFb-2av8-DuRq-vKee-nJEt-ZLnu26 --restorefile vol0.txt /dev/md127

and I could recover the volume group and all its logical volumes using

sudo vgcfgrestore -f vol0.txt vol0

Thanks for helping!

On Mar 27, 2013, at 21:08 , Stuart D Gathman <stuart at bmsi.com> wrote:

> On 03/25/2013 05:50 PM, Björn Nadrowski expounded in part:
>> Well, I see I would have to remove the volume group first, at the very least.
> I wouldn't.  Just think of your vgcreate as removing all LVs and renaming the VG.  Now you want to undo all that
> with a vgcfgrestore.
>> But I would just be back in the middle of my problem description on ubuntuforums, wouldn' t I?
>> Still no volume group, still no logical volumes...
> Does knoppix have an older lvm version that doesn't recognize your metadata?  I *hope* it doesn't have lvm1, which used binary metadata....
> If you see the human readable metadata, and knoppix doesn't, then there is a problem with knoppix.  Either ancient lvm, or the device filtered out for vgscan in lvm.conf.
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20130328/b6bed662/attachment.htm>

More information about the linux-lvm mailing list