[linux-lvm] vg disappeared after replacing disc in raid10

Björn Nadrowski bjrnfrdnnd at gmail.com
Tue Mar 26 18:13:34 UTC 2013


On Mar 26, 2013, at 14:41 , Stuart D Gathman <stuart at bmsi.com> wrote:

> Long ago, Nostradamus foresaw that on 03/25/2013 05:45 PM, Björn
> Nadrowski would write:
>> You were right,
>> the data has been overwritten.
>> It now reads thus (or rather, the first instance of human-readable
>> volume group description reads thus; my old volume group description
>> is still there, but further down...):
> Now you are getting somewhere.  The offset of your PV has shifted. 
> First, copy that 2nd human readable part to removable media somewhere. 
> If possible, backup your drives (e.g. to USB drives) so you can recover
> from further mistakes.
> 
> Why has the offset shifted?  Possibilities:
> 
> 1) different md driver version on knoppix (although using an older
> version would move the md superblock from end of drive to beginning of
> drive - shifting the opposite way).  Or different options.  BUT mdadm
> seemed to recognize your RAID, so let's
> discount this theory.
> 
> 2) alignment options to pvcreate - but it still should have been seen by
> lvs!
> 
> 3) the offset hasn't shifted, but you've written over the first few
> sectors with the empty VG.  Is the 2nd human readable part, by any
> chance, missing the first part?  You could post both parts for us to
> look at.
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Thanks for all these hints. 
I can actually just restore the first bytes of the device as I saved the output of the original dd command to a file. 

sudo dd if=/dev/md127 bs=512 count=255 skip=1 of=md0.txt

So I could just do 
sudo dd if=md0.txt bs=512 count=255 skip=1 of=/dev/md127

Might this be the appropriate action?

I doubt that the entire array has shifted, as md0.txt contained two complete human-readable descriptions of my volume groups and my 
logical volumes. This is the human-readable part of md0.txt (result of the dd command right after disc replacement):

------------------------------
vol0 {
id = "2daJft-nq2X-zJen-2VO1-c2Od-HREv-zyjKTz"
seqno = 7
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192
max_lv = 0
max_pv = 0

physical_volumes {

pv0 {
id = "WFo1On-anFb-2av8-DuRq-vKee-nJEt-ZLnu26"
device = "/dev/md0"

status = ["ALLOCATABLE"]
dev_size = 5820316928
pe_start = 384
pe_count = 710487
}
}

logical_volumes {

root {
id = "iO0y32-L53R-msRI-3JiE-t7j1-Ija2-3SOnpC"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 11920

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 0
]
}
}

home {
id = "1Vk6QQ-c3NF-6z6h-zw7E-fkFU-mRWU-DKLM6t"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 674725

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 11920
]
}
}
}
}
# Generated by LVM2 version 2.02.39 (2008-06-27): Wed Jun 10 13:21:55 2009

contents = "Text Format Volume Group"
version = 1

description = ""

creation_host = "cn-b204-4"	# Linux cn-b204-4 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64
creation_time = 1244640115	# Wed Jun 10 13:21:55 2009






vol0 {
id = "2daJft-nq2X-zJen-2VO1-c2Od-HREv-zyjKTz"
seqno = 8
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192
max_lv = 0
max_pv = 0

physical_volumes {

pv0 {
id = "WFo1On-anFb-2av8-DuRq-vKee-nJEt-ZLnu26"
device = "/dev/md0"

status = ["ALLOCATABLE"]
dev_size = 5820316928
pe_start = 384
pe_count = 710487
}
}

logical_volumes {

root {
id = "iO0y32-L53R-msRI-3JiE-t7j1-Ija2-3SOnpC"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 11920

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 0
]
}
}

home {
id = "1Vk6QQ-c3NF-6z6h-zw7E-fkFU-mRWU-DKLM6t"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 674725

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 11920
]
}
}

empty {
id = "YToY9o-223w-nMrv-X5qU-0S8t-oUbG-Zk6ZmV"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 23842

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 686645
]
}
}
}
}
# Generated by LVM2 version 2.02.39 (2008-06-27): Wed Jun 10 13:22:04 2009

contents = "Text Format Volume Group"
version = 1

description = ""

creation_host = "cn-b204-4"	# Linux cn-b204-4 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64
creation_time = 1244640124	# Wed Jun 10 13:22:04 2009

---------------------------

This is the human-readable part of the beginning of the device after my vgcreate action:

---------------------------

vol0 {
id = "8kEHPL-yDuF-7ffg-GeGH-dEg6-D0Qn-lUrKoh"
seqno = 1
format = "lvm2" # informational
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192
max_lv = 0
max_pv = 0
metadata_copies = 0

physical_volumes {

pv0 {
id = "WFo1On-anFb-2av8-DuRq-vKee-nJEt-ZLnu26"
device = "/dev/md127"

status = ["ALLOCATABLE"]
flags = []
dev_size = 5820316928
pe_start = 384
pe_count = 710487
}
}

}
# Generated by LVM2 version 2.02.95(2) (2012-03-06): Sun Mar 24 23:39:50 2013

contents = "Text Format Volume Group"
version = 1

description = ""

creation_host = "Microknoppix"	# Linux Microknoppix 3.6.11 #12 SMP PREEMPT Thu Dec 20 04:04:10 CET 2012 i686
creation_time = 1364168390	# Sun Mar 24 23:39:50 2013




vol0 {
id = "2daJft-nq2X-zJen-2VO1-c2Od-HREv-zyjKTz"
seqno = 8
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192
max_lv = 0
max_pv = 0

physical_volumes {

pv0 {
id = "WFo1On-anFb-2av8-DuRq-vKee-nJEt-ZLnu26"
device = "/dev/md0"

status = ["ALLOCATABLE"]
dev_size = 5820316928
pe_start = 384
pe_count = 710487
}
}

logical_volumes {

root {
id = "iO0y32-L53R-msRI-3JiE-t7j1-Ija2-3SOnpC"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 11920

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 0
]
}
}

home {
id = "1Vk6QQ-c3NF-6z6h-zw7E-fkFU-mRWU-DKLM6t"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 674725

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 11920
]
}
}

empty {
id = "YToY9o-223w-nMrv-X5qU-0S8t-oUbG-Zk6ZmV"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1

segment1 {
start_extent = 0
extent_count = 23842

type = "striped"
stripe_count = 1	# linear

stripes = [
"pv0", 686645
]
}
}
}
}
# Generated by LVM2 version 2.02.39 (2008-06-27): Wed Jun 10 13:22:04 2009

contents = "Text Format Volume Group"
version = 1

description = ""

creation_host = "cn-b204-4"	# Linux cn-b204-4 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64
creation_time = 1244640124	# Wed Jun 10 13:22:04 2009


---------------------------------

It seems, in both cases I have the description of the two last configurations of my volume group. The first one is the actual one. 
Both are complete.

So, should I rewrite the beginning of the device with the dd command?

What then?

Thanks a lot for all your help!




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20130326/332302df/attachment.htm>


More information about the linux-lvm mailing list