linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] restoring a volume group?
       [not found] <E16deQF-0003Mb-00@hermes.sistina.com>
@ 2002-02-20 16:27 ` Erick Calder
  2002-02-20 17:11   ` Andreas Dilger
  0 siblings, 1 reply; 2+ messages in thread
From: Erick Calder @ 2002-02-20 16:27 UTC (permalink / raw)
  To: linux-lvm

hello everyone,

it's been quite some time since I participate in this list... my LVM
installation has just purred along much to my satisfaction.  1,000 thanks to
all the people whose effort has going into getting it right.

recently I did something horrible to my system (was building an RPM with
someone else's spec file which performed a "rm -rf /" (as root)) and as I
have everything (/boot, /root, /usr, /etc, /lib... etc.) on a single
partition (/dev/hda1) and seemed unable to restore from dumps on the live
filesystem I was forced to install Linux on a different partition so I could
mount /dev/hda1 without it being my root...  trouble was I didn't have a
spare partition so I had to take /dev/hda3, one of the physical volumes in
my volume group.

I thus installed Linux there blowing away what was there, did my restore,
put the partition type back to LVM and then did a "pvcreate /dev/hda3"...
however, I found I could not reload the volume... "vgchange -a y" reporting
there were no volume groups found...

I therefore deleted /dev/LVM (my volume group) and its contents, and tried
to recreate it:

	# vgcreate /dev/LVM /dev/hda3 /dev/hdc

but this complained that /dev/hdc already belonged to the group LVM, so a:

	# pvcreate -ff /dev/hdc

and I promptly blew away the data there, allowing me to start from
scratch...

now, after my long description (and thank you for taking the interest to
read this far), my question is: was my data in /dev/hdc in any way
recoverable?  given the circumstances, did I take the only steps I could
have taken? and what can any of you suggest I could/should have done
differently?

1,000 thanks - e

p.s. in the time I've been away from the list I've learnt a lot about
building RPMs... so as I move forward I am still hopeful to make good on a
promise to build RPMs for LVM... will be back with more on that.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-lvm] restoring a volume group?
  2002-02-20 16:27 ` [linux-lvm] restoring a volume group? Erick Calder
@ 2002-02-20 17:11   ` Andreas Dilger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2002-02-20 17:11 UTC (permalink / raw)
  To: Erick Calder; +Cc: linux-lvm

On Feb 20, 2002  14:22 -0800, Erick Calder wrote:
> recently I did something horrible to my system (was building an RPM with
> someone else's spec file which performed a "rm -rf /" (as root)) and as I
> have everything (/boot, /root, /usr, /etc, /lib... etc.) on a single
> partition (/dev/hda1) and seemed unable to restore from dumps on the live
> filesystem I was forced to install Linux on a different partition so I could
> mount /dev/hda1 without it being my root...  trouble was I didn't have a
> spare partition so I had to take /dev/hda3, one of the physical volumes in
> my volume group.
> 
> I thus installed Linux there blowing away what was there, did my restore,
> put the partition type back to LVM and then did a "pvcreate /dev/hda3"...
> however, I found I could not reload the volume... "vgchange -a y" reporting
> there were no volume groups found...
> 
> I therefore deleted /dev/LVM (my volume group) and its contents, and tried
> to recreate it:
> 
> 	# vgcreate /dev/LVM /dev/hda3 /dev/hdc
> 
> but this complained that /dev/hdc already belonged to the group LVM, so a:
> 
> 	# pvcreate -ff /dev/hdc
> 
> and I promptly blew away the data there, allowing me to start from
> scratch...

Ok, basically a series of wrong operations has gotten you into a hole...

The correct order of operations would have been:
- Don't use bad spec file (oops).
- Test your backup (yes, hindsight is golden).
- Use a rescue disk to boot and recover your data.
- As long as you are not reformatting, you could have reinstalled over the
  old root partition and it would have kept all of your data.

> now, after my long description (and thank you for taking the interest to
> read this far), my question is: was my data in /dev/hdc in any way
> recoverable?  given the circumstances, did I take the only steps I could
> have taken? and what can any of you suggest I could/should have done
> differently?

Now, as to the LVM part:
- You should have used vgcfgrestore to restore the LVM metadata to
  /dev/hda3, and all would have been well.
- Your data on /dev/hdc may still be recoverable, depending on what you
  have done in the meantime.  Try vgcfgrestore for both hda3 and hdc and
  you might get it back.
- If you have whole filesystems contained on /dev/hdc you can use something
  like gpart (or findsuper in the e2fsprogs source is best for ext2) to find
  the filesystem superblock and recover the whole fs.

> p.s. in the time I've been away from the list I've learnt a lot about
> building RPMs... so as I move forward I am still hopeful to make good on a
> promise to build RPMs for LVM... will be back with more on that.

Well, I don't think people will be rushing out to use your .spec files any
time soon ;-).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-20 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E16deQF-0003Mb-00@hermes.sistina.com>
2002-02-20 16:27 ` [linux-lvm] restoring a volume group? Erick Calder
2002-02-20 17:11   ` Andreas Dilger

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).