Skip to contentSkip to conversation

How to recover data corrupted by vgcreate

linux-lvm 張廷州 3 participants 5 messages Jul 26, 2005 – Jul 28, 2005

lore
Share & tools
lore

張廷州

author
#0 lore raw

Hi,

I have a Linux PC with Fedora C3 installed.
The disk was partitioned automatically when Linux was installed.
So, LVM2 partition was created.
The CPU is damaged today and I move the disk to another Linux PC and try to read data out. The disk is connected to device /dev/hdd. /dev/hdd2 is the LVM2 partition. But, I do a stupid thing. I invoke vgcreate command on /dev/hdd2.

vgcreate vg_name /dev/hdd2

The partition seems to be lost.
How can I recover the data in /dev/hdd2?
It's very important data to me.
Thanks for any help.

Davis

#1 lore raw

I'm not familiar exactly with how the metadata gets laid on disk, but I would think you could just 'vgcreate vg_name /dev/hdd2' (you did this already) then 'lvcreate -n <lvname> -l <max size> vg_name'... This of course assumes that the previous lv resided wholly on /dev/hdd2. Then try mounting the new lv and see what happens.

brassow

Quoted 16 lines · 張廷州

Hi,

I have a Linux PC with Fedora C3 installed.
The disk was partitioned automatically when Linux was installed.
So, LVM2 partition was created.
The CPU is damaged today and I move the disk to another Linux PC and try to read data out. The disk is connected to device /dev/hdd. /dev/hdd2 is the LVM2 partition. But, I do a stupid thing. I invoke vgcreate command on /dev/hdd2.

vgcreate vg_name /dev/hdd2

The partition seems to be lost.
How can I recover the data in /dev/hdd2?
It's very important data to me.
Thanks for any help.

Quoted 6 lines

Davis
_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

I'm not familiar exactly with how the metadata gets laid on disk, but I would think you could just 'vgcreate vg_name /dev/hdd2' (you did this already) then 'lvcreate -n <<lvname> -l <<max size> vg_name'... This of course assumes that the previous lv resided wholly on /dev/hdd2. Then try mounting the new lv and see what happens.

brassow

On Jul 26, 2005, at 11:57 AM, <fontfamily><param>Hiragino Kaku Gothic Pro</param>張廷州</fontfamily> wrote:

<excerpt><smaller>Hi,</smaller>

<smaller> </smaller>

<smaller>I have a Linux PC with Fedora C3 installed.</smaller>

<smaller>The disk was partitioned automatically when Linux was installed.</smaller>

<smaller>So, LVM2 partition was created.</smaller>

<smaller>The CPU is damaged today and I move the disk to another Linux PC and try to read data out.</smaller>

<smaller>The disk is connected to device /dev/hdd. /dev/hdd2 is the LVM2 partition.</smaller>

<smaller>But, I do a stupid thing. I invoke vgcreate command on /dev/hdd2.</smaller>

<smaller> </smaller>

<smaller> vgcreate vg_name /dev/hdd2</smaller>

<smaller> </smaller>

<smaller>The partition seems to be lost.</smaller>

<smaller>How can I recover the data in /dev/hdd2?</smaller>

<smaller>It's very important data to me.</smaller>

<smaller>Thanks for any help.</smaller>

<smaller> </smaller>

<smaller>Davis</smaller>

<smaller> </smaller>_______________________________________________

linux-lvm mailing list

[email protected]

https://www.redhat.com/mailman/listinfo/linux-lvm

read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/</excerpt>

#2 lore raw
Quoted 5 lines · Jonathan E Brassow

I'm not familiar exactly with how the metadata gets laid on disk, but I would think you could just 'vgcreate vg_name /dev/hdd2' (you did this already) then 'lvcreate -n <lvname> -l <max size> vg_name'... This of course assumes that the previous lv resided wholly on /dev/hdd2. Then try mounting the new lv and see what happens.

Before you do that, try vgcfgrestore.

Quoted 35 lines · 張廷州
Quoted 20 lines

Hi,

I have a Linux PC with Fedora C3 installed.
The disk was partitioned automatically when Linux was installed. So, LVM2 partition was created.
The CPU is damaged today and I move the disk to another Linux PC and try to read data out.
The disk is connected to device /dev/hdd. /dev/hdd2 is the LVM2 partition.
But, I do a stupid thing. I invoke vgcreate command on /dev/hdd2.

vgcreate vg_name /dev/hdd2

The partition seems to be lost.
How can I recover the data in /dev/hdd2?
It's very important data to me.
Thanks for any help.

Quoted 6 lines

Davis
_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 8 lines
AJ Lewis                                   Voice:  612-638-0500
Red Hat                                    E-Mail: [email protected]
One Main Street SE, Suite 209
Minneapolis, MN 55414
   
Current GPG fingerprint = D9F8 EDCE 4242 855F A03D  9B63 F50C 54A8 578C 8715
Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the
many keyservers out there...
#3 lore raw
Quoted 9 lines · AJ Lewis
Quoted 5 lines · Jonathan E Brassow

I'm not familiar exactly with how the metadata gets laid on disk, but I would think you could just 'vgcreate vg_name /dev/hdd2' (you did this already) then 'lvcreate -n <lvname> -l <max size> vg_name'... This of course assumes that the previous lv resided wholly on /dev/hdd2. Then try mounting the new lv and see what happens.

Before you do that, try vgcfgrestore.

AJ, when he did the initial 'vgcreate' was part of the process to create a backup copy of the metadata? If so, vgcfgrestore could work. But otherwise, I'm not sure were the old metadata would be stored, since this disk is from a different machine... Seems odd to me that vgcreate would blow over the old vg if it knew about it. If it did not know (or detect the old vg), how would it know to backup the metadata?

brassow

#4 lore raw
Quoted 14 lines · Jonathan E Brassow
Quoted 10 lines · AJ Lewis
Quoted 6 lines · Jonathan E Brassow

I'm not familiar exactly with how the metadata gets laid on disk, but I would think you could just 'vgcreate vg_name /dev/hdd2' (you did this
already) then 'lvcreate -n <lvname> -l <max size> vg_name'... This of course assumes that the previous lv resided wholly on /dev/hdd2. Then try mounting the new lv and see what happens.

Before you do that, try vgcfgrestore.

Quoted 6 lines

AJ, when he did the initial 'vgcreate' was part of the process to create a backup copy of the metadata? If so, vgcfgrestore could work. But otherwise, I'm not sure were the old metadata would be stored, since this disk is from a different machine... Seems odd to me that vgcreate would blow over the old vg if it knew about it. If it did not know (or detect the old vg), how would it know to backup the metadata?

Not sure, but if the reason the disk was moved was because a cpu went out, i'm assuming the old root fs is also on that disk - hoping so anyway ;) If so, the old root fs can be mounted and /etc/lvm/archive can be checked for a valid copy of the metadata. (Assuming root wasn't on lvm...)

As to why vgcreate didn't recognize the old VG...that's very odd - not sure what went wrong there...

Signature · 8 lines
AJ Lewis                                   Voice:  612-638-0500
Red Hat                                    E-Mail: [email protected]
One Main Street SE, Suite 209
Minneapolis, MN 55414
   
Current GPG fingerprint = D9F8 EDCE 4242 855F A03D  9B63 F50C 54A8 578C 8715
Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the
many keyservers out there...