linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jonathan E Brassow <jbrassow@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] How to restore a PV ??
Date: Mon, 16 Oct 2006 14:20:14 -0500	[thread overview]
Message-ID: <01dbd6887fd9d439599e31bda27f3883@redhat.com> (raw)
In-Reply-To: <4533ABCD.8030502@ibt.unam.mx>

On each disk in the volume group is a record of the changes that have 
been made to the volume group.  The last item in the record is the 
current lvm meta-data.  If you can retrieve that, it is the same as 
having the backup file which would normally be found in 
/etc/lvm/backup.

You could use hexdump, but I find it much simpler to use 'less -f 
<device>'.  You should see something like:

<crap>
principal {
...
}
<comments>
<crap>
principal {
...
}
<comments>
<crap>

You should be able to search for 'principal' (the name of your volume 
group) to locate the first record.  As I said, this "meta data area" of 
the disk keeps a history of your volume group changes.  That is, rather 
than overwriting the record, it writes the new metadata format after 
the last one (in a circular buffer fashion).  You can use the 'seqno' 
field to determine the newest one.  Also, the metadata is written in 
text to the disk, so it should be simple enough to read it and 
determine if everything looks fine.

Once you've found the latest copy of the metadata, copy it - including 
comments - to a file and use 'vgcfgrestore -t -f <file> <vgname>' to 
test it.  Once satisfied, perform the 'vgcfgrestore -f <file> 
<vgname>'.

If all else fails, you can use dd to grab me the first chunk of the 
disk, and I'll recreate the backup file for you.  ('dd if=<one of the 
good devs> of=<output file> bs=1M count=1;  bzip2 <output file>; send 
me <output file>.bz2')

  brassow

On Oct 16, 2006, at 10:57 AM, Jerome wrote:

> jbrassow wrote:
> >does 'vgcfgrestore principal' work?
> >
> > brassow
> >
> Hi Jonathan,
> i try to use this command, and i've received this error mesage:
>
> /etc/lvm/backup/principal: stat failed: No such file or directory
> Couldn't read volume group metadata.
> Restore failed.
>
> I mean that i've lost the /etc/lv/ directory lost. I've read some 
> information about how to construct the Metadata file with hexdump 
> command (cf : 
> https://www.redhat.com/archives/linux-lvm/2006-June/msg00049.html).
> But i not sure how to do this yet.
>
> Thank's a lot.
>
>
>
>
> -- 
> -- J�r�me
> Il n'y a point de g�nie sans un grain de folie.
> 	(Aristote)
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>

  reply	other threads:[~2006-10-16 19:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13  1:27 [linux-lvm] How to restore a PV ?? Jerome
2006-10-16 15:43 ` Jonathan E Brassow
2006-10-16 15:57 ` Jerome
2006-10-16 19:20   ` Jonathan E Brassow [this message]
2006-11-14 23:00     ` Brian McCullough
2006-11-14 23:06       ` Alasdair G Kergon
2006-11-15  1:32         ` Brian McCullough
2006-11-15  3:45           ` Brian McCullough
2006-11-17 13:44         ` Brian McCullough
2006-11-17 19:21           ` Alasdair G Kergon
2006-11-18 10:24             ` Brian McCullough

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01dbd6887fd9d439599e31bda27f3883@redhat.com \
    --to=jbrassow@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).