Hi,
I finally managed to access a SME7 LVM RAID on another SME7 server.
Process is not hard, but requires that you know why and what you are doing.
This is an emergency rescue procedure, and think about having a backup of the systeme you are working on.
Steps to follow are :
* Retrieve the source RAID arry definition
[root@ixus ~]# mdadm --examine --scan /dev/sdc2
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=e8cd2148:6e9e3fb7:12e3c7d8:d5e2d146
devices=/dev/sdc2
[root@ixus ~]#
* Start the RAID array with a new metadevice ID (in the sample below it is renumbered from
md2 to
md3 the "ARRAY" line only ends after the "missing" word.
[root@ixus ~]# cat >> /etc/mdadm.conf
DEVICE /dev/sdc2
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=e8cd2148:6e9e3fb7:12e3c7d8:d5e2d146 devices=/dev/sdc2,missing
[root@ixus ~]#
[root@ixus ~]# mdadm -A --scan /dev/md3
mdadm: only specify super-minor once, super-minor=2 ignored.
mdadm: only specify super-minor once, super-minor=1 ignored.
mdadm: /dev/md3 has been started with 1 drive (out of 2).
[root@ixus ~]#
* Retrieve the source VG definition
[root@ixus ~]# dd if=/dev/md3 bs=512 count=255 skip=1 of=/tmp/header_md3
255+0 records in
255+0 records out
[root@ixus ~]#
The resulting file is made of text and binaries informations. This part of the disk is used in a cyclic way so you might find more than once the informations. Check "man lvm.conf" for more details.
You have to edit this file and only keep the required informations to fill up the gaps in the below template :
main_1 { ...
physical_volumes { ...
pv0 { ...
}
logical_volumes { ...
root { ...
segment1 { ...
stripes = [ ...
}
}
swap { ...
segment1 { ...
stripes = [ ...
}
}
}
}
Check the way the file has to look like with the /etc/lvm/backup/main one for instance. Double, triple check the syntax.
Do not forget to change the volume label. I change it from
main to
main_1 in the above sample.
* Add the VG definition to your new system
[root@ixus ~]# vgcfgrestore -f /tmp/header_md3 main_1
Restored volume group main_1
[root@ixus ~]#
[root@ixus ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "main_1" using metadata type lvm2
Found volume group "main" using metadata type lvm2
[root@ixus ~]#
[root@ixus ~]# vgchange -a y main_1
2 logical volume(s) in volume group "main_1" now active
[root@ixus ~]#
[root@ixus ~]# mount /dev/main_1/root /mnt
* that's all
The above informations are freely adapted from
Richard Bullington-McGuire's article in the Linux Journal.
You are working with low level informations, so really think and care about what you are doing.
Gaston