[linux-lvm] deleted LV recovery: understanding metadata format and determining LV extents

Thanos Makatos thanos.makatos at citrix.com
Sat Jan 10 18:12:03 UTC 2015


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







More information about the linux-lvm mailing list