* [linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents
@ 2015-01-10 18:12 Thanos Makatos
[not found] ` <1420926501.92697.YahooMailBasic@web181504.mail.ne1.yahoo.com>
2015-01-11 17:33 ` Alasdair G Kergon
0 siblings, 2 replies; 4+ messages in thread
From: Thanos Makatos @ 2015-01-10 18:12 UTC (permalink / raw)
To: linux-lvm@redhat.com
Hi, I'm working on a case where a bunch of logical volumes were deleted but now we need them back. We have disabled archives and back ups in lvm.conf. They way I am trying to approach the problem is to examine LVM's metadata (the first MB of the block device) and determine whether the extents used by these logical volumes have been assigned to other logical volumes.
I am developing a script (which I hope to upstream) that does that however I need some clarification regarding the meaning of some of the metadata. I have focused on the list of segments in each logical volume definitation but I don't know how to interpret the "stripes" member. These are all linear LVs.
What is this "stripes" member and how is it related to "start_extent" and "extent_count"?
E.g. I have the following two LV definitions (the rest of the metadata is ommitted):
foo {
id = "..."
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1
segment1 {
start_extent = 0
extent_count = 2
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 306705
]
}
}
bar {
id = "..."
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 9
# segments 1-8 ommitted
segment9 {
start_extent = 59162
extent_count = 3662
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 246616
]
}
}
I thought that the "stripes" is some extent from which the "start_extent" is calculated but I think I'm wrong because the segments of these two LVs overlap. How can I determine which extents are used by each LV?
Any help greatly appreciated.
--
Thanos Makatos
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <1420926501.92697.YahooMailBasic@web181504.mail.ne1.yahoo.com>]
* Re: [linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents
[not found] ` <1420926501.92697.YahooMailBasic@web181504.mail.ne1.yahoo.com>
@ 2015-01-11 10:47 ` Thanos Makatos
2015-01-11 13:12 ` matthew patton
0 siblings, 1 reply; 4+ messages in thread
From: Thanos Makatos @ 2015-01-11 10:47 UTC (permalink / raw)
To: matthew patton; +Cc: linux-lvm@redhat.com
> > know how to interpret the "stripes" member. These are all linear LVs.
> >
> > stripes = [� "pv0", 306705 ]
>
> do the values make sense from a 512byte block point of view? Either as extent-size * #extents = size in 512kb blocks,
> or as an absolute offset from the beginning of PV0 device? or it might be the offset in extent-size from the beginning
> of the PV0 data area. Yeah, it's probably that.
I don't think these units are expressed in anything else but extent size units (http://tldp.org/HOWTO/LVM-HOWTO/pe.html).
I did the following test: I created two LV and compared the LVM metadata against the output of lvdisplay -m, here's what I got:
First volume, LVM metadata:
segment1 {
start_extent = 0
extent_count = 256
type = "striped"
stripe_count = 1
stripes = ["pv0", 2568]
}
First volume, lvdisplay -m:
--- Segments ---
Logical extent 0 to 255:
Type linear
Physical volume /dev/sda3
Physical extents 2568 to 2823
Second volume, LVM metadata:
segment1 {
start_extent = 0
extent_count = 2567
type = "striped"
stripe_count = 1
stripes = ["pv0", 1]
}
Second volume, lvdisplay -m:
--- Segments ---
Logical extent 0 to 2566:
Type linear
Physical volume /dev/sda3
Physical extents 1 to 2567
Or have I got it completely wrong?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents
2015-01-10 18:12 [linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents Thanos Makatos
[not found] ` <1420926501.92697.YahooMailBasic@web181504.mail.ne1.yahoo.com>
@ 2015-01-11 17:33 ` Alasdair G Kergon
1 sibling, 0 replies; 4+ messages in thread
From: Alasdair G Kergon @ 2015-01-11 17:33 UTC (permalink / raw)
To: Thanos Makatos; +Cc: linux-lvm@redhat.com
On Sat, Jan 10, 2015 at 06:12:03PM +0000, Thanos Makatos wrote:
> Hi, I'm working on a case where a bunch of logical volumes were deleted but now we need them back. We have disabled archives and back ups in lvm.conf. They way I am trying to approach the problem is to examine LVM's metadata (the first MB of the block device) and determine whether the extents used by these logical volumes have been assigned to other logical volumes.
So start by looking at the contents of the metadata areas and see if they still
contain backups you can extract.
They are circular buffers so look for the seqno field which is incremented
each time the metadata is changed.
lvmdump -m can grab the metadata.
'pvck -v $device' contains the beginnings of code to extract the backups
Alasdair
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-11 17:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-10 18:12 [linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents Thanos Makatos
[not found] ` <1420926501.92697.YahooMailBasic@web181504.mail.ne1.yahoo.com>
2015-01-11 10:47 ` Thanos Makatos
2015-01-11 13:12 ` matthew patton
2015-01-11 17:33 ` Alasdair G Kergon
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).