HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Technical (http://www.howtoforge.com/forums/forumdisplay.php?f=8)
-   -   Restore lvm after destroying boot disk (http://www.howtoforge.com/forums/showthread.php?t=57568)

Bitsofme 7th June 2012 19:45

Restore lvm after destroying boot disk
 
1 Attachment(s)
Hi All,

I need to restore my lvm after destroying my boot disk during an upgrade.

I have used the information on this http://www.howtoforge.com/recover_da...lvm_partitions
as a starting point and have got so far but got stuck.

I do not have a raid just three disks linked into a volume group so I skipped the first part and started at the Recovering The LVM Setup section.

I used the dd command (also piped the output into strings to clean it up) and created this config file
Code:

# Generated by LVM2 version 2.02.95(2) (2012-03-06): Mon Jun  4 17:01:30 2012

contents = "Text Format Volume Group"
version = 1

description = ""

creation_host = "(none)"        # Linux (none) 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64
creation_time = 1338829290        # Mon Jun  4 17:01:30 2012

vg_big {
        id = "OBZT6E-tzAO-v80A-kN38-R1Uo-3GRI-dXd4wj"
        seqno = 13
        format = "lvm2" # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192
        max_lv = 256
        max_pv = 256
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "PCNHHY-LSvJ-jKbt-TXbN-tceZ-0GPe-tshRED"
                        device = "/dev/sdb"

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907029168
                        pe_start = 384
                        pe_count = 476932
                }

                pv1 {
                        id = "h8j1UC-Uckf-Ob3w-UTea-nUfT-JPWc-sVdjeF"
                        device = "/dev/sdc"

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907029168
                        pe_start = 384
                        pe_count = 476932
                }

                pv2 {
                        id = "Ixsun3-rGKx-0xWB-tqFK-RDYq-OuNR-qIj5sO"
                        device = "/dev/sda"

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907029168
                        pe_start = 2048
                        pe_count = 476932
                }
        }

        logical_volumes {

                big        {
                        id = "ptLLIA-nQhQ-JsBQ-wur0-fejd-wV4E-Xj1PyR"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 953864

                                type = "striped"
                                stripe_count = 1
                                stripe_size = 8

                                stripes = [
                                        "pv0", 0,
                                        "pv2", 0
                                ]
                        }
                }
        }
}

In the stripes part it lists only two pv's PV0 and PV2 is this correct?

I tried vgconfigrestore with the -t for test and got

Test mode: Metadata will NOT be updated and volumes will not be (de)activated.
Couldn't find device with uuid PCNHHY-LSvJ-jKbt-TXbN-tceZ-0GPe-tshRED.
Couldn't find device with uuid Ixsun3-rGKx-0xWB-tqFK-RDYq-OuNR-qIj5sO.
Segment with extent 953864 in PV unknown device not found
Couldn't read all logical volumes for volume group vg_big.
Restore failed.

I am guessing that I need to assign uuids to the disks to match the old config?

Any ideas?

Thanks

I have attached the output from the dd command after it has been cleaned with strings

Bitsofme 9th June 2012 18:20

More info
 
Just some more info about the problem

lvmdiskscan
/dev/sda [ 1.82 TiB]
/dev/vg_main/lv_swap [ 13.72 GiB]
/dev/vg_main/lv_root [ 50.00 GiB]
/dev/vg_main/lv_home [ 84.81 GiB]
/dev/sdb [ 1.82 TiB]
/dev/sdc [ 1.82 TiB] LVM physical volume
/dev/sdd1 [ 500.00 MiB]
/dev/sdd2 [ 148.56 GiB] LVM physical volume
5 disks
1 partition
1 LVM physical volume whole disk
1 LVM physical volume



[root@main uuid_fixer]# fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2c33c642

Device Boot Start End Blocks Id System

Disk /dev/sdd: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312579695 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dd6fd

Device Boot Start End Blocks Id System
/dev/sdd1 * 2048 1026047 512000 83 Linux
/dev/sdd2 1026048 312578047 155776000 8e Linux LVM

Disk /dev/mapper/vg_main-lv_swap: 14.7 GB, 14730395648 bytes
255 heads, 63 sectors/track, 1790 cylinders, total 28770304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_main-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_main-lv_home: 91.1 GB, 91066728448 bytes
255 heads, 63 sectors/track, 11071 cylinders, total 177864704 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


All times are GMT +2. The time now is 14:46.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.