[linux-lvm] f*cked up metadata on 1of3 LVM-disks

Dave Wysochanski dwysocha at redhat.com
Thu May 24 21:42:02 UTC 2007


On Mon, 2007-05-21 at 11:57 -0400, Dave Wysochanski wrote:
> On Mon, 2007-05-21 at 12:38 +0200, BigMac wrote:
> > Nobody an idea how to recover the lvm meta data on the disk?
> > The data itself an the other disks are fine, just the first sectors of
> > /dev/hdc are gone by installing grub on it.
> > 
> > I had a deeper look on the disk with one of those low level disk editors
> > and there are still parts of the meta-data stored on the disk.
> > It seems to be that grub messed up just the first 17 sectors of the disk.
> > 
> > Regards,
> > 
> > BigMac
> > 
> 
> I am working on a tool to do recovery and pull metadata out of the
> disks.  Maybe this will help you.  
> 
> You can try "pvck -v" in the latest upstream LVM code.  It does not
> extract metadata to a file yet but makes an attempt at identifying areas
> on the disk that contain metadata and prints the offsets and lengths
> (you can then just dd to a file).  Since you have other PVs that are
> valid you could at least get the latest metadata off one of those, then
> use vgcfgrestore with this file and uuid option.
> 

Here is a nasty awk cmdline you could use for example (just replace
loop1 with whatever your device is named).  Remember you should run this
on one of your good PVs.

pvck -v /dev/loop1 2>&1 | grep "metadata record" | awk '{print "dd
if=/dev/loop1 bs=1 skip="substr($6,8,length($6)-8) "
count="substr($7,6,length($7)-6) " of=/tmp/dev-loop1-" NR ".bin" }'
> /tmp/doit.sh

Working on a real extract option to pvck though as this is certainly a
bit rough (some NULL chars still at the end of each file, etc).




More information about the linux-lvm mailing list