LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-07-2009, 09:12 PM   #1
swan-1
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: Disabled
Question Recover data from a reallocated(?) LVM2 drive set?


I *think* what happened is as follows: I was replacing a dead boot drive in a Fedora 11 system that also had two 250gig drives setup as a single LVM2 partition (mounted as /store in the old system). The LVM2 was formatted with JFS.

As part of installing FC11 to the new boot drive, the install seems to have setup a new LVM2 using all 3 drives in the system (the new boot, plus the two 250gig drives). I suspect it's formatted the 250gig drives with ext3 as well.

Is there anyway to recover the data on the old LVM2 drives?
 
Old 07-08-2009, 06:20 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,699
Blog Entries: 54

Rep: Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962Reputation: 2962
Think of LVM as a set of "containers" (PV > VG > LV > filesystem). To get to the point where your filesystem (remnants) may become accessable (in one way or the other) you have to "open" each container to access the other within. Creating a LVM requires a few commands, the first being 'pvcreate' to create the Physical Volume(s). This command takes the "--metadatacopies" switch which allows you to set one or more copies of metadata. If the value is 1 then only one copy is available at the start of the PV, when it's 2 you have one copy at the start and one at the end of the PV to read from. If the installer defaults to 1 then the next round of PV creation will overwrite that single source of metadata. With 'pvcreate --restorefile' you can restore metadata from the /etc/lvm/backup/, but if that data is no longer available on disk (or from backup?) and unless running 'testdisk /debug /log' on the disks may reveal something you have a chicken-and-egg scenario I wouldn't know how to get out of.

(BTW I sincerely doubt there would have been no warning that the disks contained data and that repartitioning them would destroy old data. That being the case it's not the installer that allowed this fsck up to happen.)
 
Old 07-14-2009, 09:56 PM   #3
swan-1
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Original Poster
Rep: Reputation: Disabled
I really shouldn't post just before a trip. Anyway, I was able to get the old boot disk to boot, and now have copies of /etc/lvm/*.

Quote:
VG2forMyth {
id = "lI40tG-b8yh-w0a4-epb7-iSZN-8QmA-xGpEgY"
seqno = 6
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 131072 # 64 Megabytes
max_lv = 0
max_pv = 0

physical_volumes {

pv0 {
id = "Liz0DB-jL1b-1NFx-zDoX-Pxco-dCWX-3nKGUd"
device = "/dev/sdc1" # Hint only

status = ["ALLOCATABLE"]
flags = []
dev_size = 488392002 # 232.883 Gigabytes
pe_start = 384
pe_count = 3725 # 232.812 Gigabytes
}

pv1 {
id = "K7e4nC-HKJV-DUv8-3WLt-0STK-JMTz-MB3Ekx"
device = "/dev/sdb1" # Hint only

status = ["ALLOCATABLE"]
flags = []
dev_size = 488392002 # 232.883 Gigabytes
pe_start = 384
pe_count = 3726 # 232.875 Gigabytes
}
}

logical_volumes {

video {
id = "7idUrc-m3JG-eEZY-2XTU-4y66-8o6B-sLYMma"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 2

segment1 {
start_extent = 0
extent_count = 3725 # 232.812 Gigabytes

type = "striped"
stripe_count = 1 # linear

stripes = [
"pv0", 0
]
}
segment2 {
start_extent = 3725
extent_count = 2835 # 177.188 Gigabytes

type = "striped"
stripe_count = 1 # linear

stripes = [
"pv1", 0
]
}
}

images {
id = "AUEquV-eh2a-qIo3-Uj5x-KrB9-BjIx-zE5Gq1"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1

segment1 {
start_extent = 0
extent_count = 160 # 10 Gigabytes

type = "striped"
stripe_count = 1 # linear

stripes = [
"pv1", 2835
]
}
}

music {
id = "nq5GUV-2XxT-vzcW-kOmw-CYMF-3D1t-3QBqvU"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1

segment1 {
start_extent = 0
extent_count = 480 # 30 Gigabytes

type = "striped"
stripe_count = 1 # linear

stripes = [
"pv1", 2995
]
}
}
}
}
So, it looks like I need to run:
pvcreate --restore /etc/lvm/backup/VG2forMyth --uuid Liz0DB-jL1b-1NFx-zDoX-Pxco-dCWX-3nKGUd /dev/sdc1

Doing so yields:
Couldn't find device with uuid 'Liz0DB-jL1b-1NFx-zDoX-Pxco-dCWX-3nKGUd'.
Couldn't find device with uuid 'K7e4nC-HKJV-DUv8-3WLt-0STK-JMTz-MB3Ekx'.
Couldn't find device with uuid 'Mh0xn3-Rk4d-D8h3-Cu2p-3l1l-5ZKg-mu0WlE'.
Couldn't find device with uuid 'Mh0xn3-Rk4d-D8h3-Cu2p-3l1l-5ZKg-mu0WlE'.
Can't initialize physical volume "/dev/sdc1" of volume group "vg_mythbe" without -ff

So, it looks like the new install did overwrite the 250gig drives. Hopefully it didn't also format with ext3, thus overwriting the JFS that was on there and loosing all my photos/music/video/data.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to recover data from external USB Drive montylee Linux - Software 6 09-22-2011 01:38 PM
Recover LVM2 with Data? bodaduk Linux - General 5 09-27-2010 01:16 PM
how to recover data from a dead hard drive mariav Linux - General 3 03-19-2007 06:37 AM
how do i salvage/recover unerased data on my hard drive? nickleus Linux - General 8 01-19-2006 10:59 AM
recover data from physically damaged drive kc8tbe Linux - General 11 05-29-2004 02:58 PM


All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration