CoEPP RC
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorial:lvm [2013/06/26 01:32] (current)
scrosby created
Line 1: Line 1:
 +====== LVM: Logical Volume Manager ======
 +
 +  *[[http://​blog.allanglesit.com/​2011/​03/​linux-lvm2-flexible-local-storage-management/​]]
 +
 +
 +===== Recovery from writing GPT header info onto an LVM partition =====
 +
 +Some useful links:
 +  * [[http://​www.pixelbeat.org/​docs/​disk/​]]
 +  * [[http://​superuser.com/​questions/​411697/​lvm-volume-with-corrupt-mbr-how-to-mount-and-recover-data-from-it]]
 +  * [[http://​www.bitbull.ch/​wiki/​index.php/​LVM_Troubleshooting_for_REL5]]
 +  * [[http://​serverfault.com/​questions/​439022/​does-lvm-need-a-partition-table]]
 +  * [[https://​wiki.archlinux.org/​index.php/​LVM]]
 +  * [[http://​mbroz.fedorapeople.org/​talks/​LinuxAlt2009_2/​lvmrecovery.pdf]]
 +
 +Very useful (although wrong about the uuids) was:
 +  * [[http://​www.linuxplanet.com/​index.php/​linuxplanet/​tutorials/​6389/​3/​]]
 +==== Get rid of GPT metadata ====
 +
 +^ Online Notes | [[http://​www.rodsbooks.com/​gdisk/​wipegpt.html]] |
 +^ Partition Tables | [[https://​wiki.archlinux.org/​index.php/​GUID_Partition_Table]] |
 +<​code>​
 +yum install gdisk
 +gdisk /dev/sdX
 +x # go into expert mode
 +z # zap the GPT metadata
 +y # yes
 +y # Also clean the MBR
 +</​code>​
 +
 +==== Get copy of the LVM metadata ====
 +
 +  * Hopefully you have a backup: check ''/​etc/​lvm/​backup''​ or ''/​etc/​lvm/​archive''​
 +  * We had 4 identical machines (ags13-16) so we could get a copy from another live system (Make sure you change the ids if you are copying from another machine): <​code>​
 +vgcfgbackup -f /​var/​tmp/​Array1.cfg Array1
 +cat /​var/​tmp/​Array1.cfg
 +</​code><​file>​
 +# Generated by LVM2 version 2.02.56(1)-RHEL5 (2010-04-22):​ Thu Nov  8 03:24:08 2012
 +
 +contents = "Text Format Volume Group"
 +version = 1
 +
 +description = "​vgcfgbackup -f /​var/​tmp/​Array1_ags14 Array1"​
 +
 +creation_host = "​ags14.atlas.unimelb.edu.au" ​   # Linux ags14.atlas.unimelb.edu.au 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:53:46 EDT 2011 x86_64
 +creation_time = 1352345048 ​     # Thu Nov  8 03:24:08 2012
 +
 +Array1 {
 +        id = "​EuaJJd-E8pa-JzKW-ZVqU-LecX-IsAc-QU2Jfz"​
 +        seqno = 4
 +        status = ["​RESIZEABLE",​ "​READ",​ "​WRITE"​]
 +        flags = []
 +        extent_size = 524288 ​           # 256 Megabytes
 +        max_lv = 0
 +        max_pv = 0
 +
 +        physical_volumes {
 +
 +                pv0 {
 +                        id = "​BJ4Z23-d9ei-hW2Z-w20E-VZap-0EMs-1ZrhfR"​
 +                        device = "/​dev/​sda" ​    # Hint only
 +
 +                        status = ["​ALLOCATABLE"​]
 +                        flags = []
 +                        dev_size = 39042949120 ​ # 18.1808 Terabytes
 +                        pe_start = 384
 +                        pe_count = 74468        # 18.1807 Terabytes
 +                }
 +        }
 +
 +        logical_volumes {
 +
 +                pool1 {
 +                        id = "​jcTWS1-5Oed-WvcN-nZ6c-3IyF-KxfW-VjVkrJ"​
 +                        status = ["​READ",​ "​WRITE",​ "​VISIBLE"​]
 +                        flags = []
 +                        segment_count = 1
 +
 +                        segment1 {
 +                                start_extent = 0
 +                                extent_count = 24574    # 5.99951 Terabytes
 +
 +                                type = "​striped"​
 +                                stripe_count = 1        # linear
 +
 +                                stripes = [
 +                                        "​pv0",​ 0
 +                                ]
 +                        }
 +                }
 +
 +                pool2 {
 +                        id = "​44LyKJ-45IU-zk72-c0YR-4WiY-o0y2-8oJAmc"​
 +                        status = ["​READ",​ "​WRITE",​ "​VISIBLE"​]
 +                        flags = []
 +                        segment_count = 1
 +
 +                        segment1 {
 +                                start_extent = 0
 +                                extent_count = 24947    # 6.09058 Terabytes
 +
 +                                type = "​striped"​
 +                                stripe_count = 1        # linear
 +
 +                                stripes = [
 +                                        "​pv0",​ 24574
 +                                ]
 +                        }
 +                }
 +
 +                pool3 {
 +                        id = "​r2IgEM-9Hu1-udzX-W2yg-Ffd8-KeTA-BVFrkn"​
 +                        status = ["​READ",​ "​WRITE",​ "​VISIBLE"​]
 +                        flags = []
 +                        segment_count = 1
 +
 +                        segment1 {
 +                                start_extent = 0
 +                                extent_count = 24947    # 6.09058 Terabytes
 +
 +                                type = "​striped"​
 +                                stripe_count = 1        # linear
 +
 +                                stripes = [
 +                                        "​pv0",​ 49521
 +                                ]
 +                        }
 +                }
 +        }
 +}
 +</​file>​
 +
 +==== Write metadata to LVM partition ​ ====
 +
 +  * The uuid in the command below is the PV uuid not the first one in the metadata backup:<​code>​
 +pvcreate -ff --uuid BJ4Z23-d9ei-hW2Z-w20E-VZap-0EMs-1Zrhfd --restorefile /​var/​tmp/​Array1_ags13 /dev/sda
 +vgcfgrestore -f /​var/​tmp/​Array1_ags13 Array1
 +lvscan
 +vgchange -ay Array 1
 +</​code>​
 +
 +
 +===== Additional troubleshooting commands used =====
 +
 +  * examine the first sector of a disk and see where data starts to be written:<​code>​
 +dd if=/dev/sda bs=1024 skip=0 count=10000 | od -Ax -tx1z -v 
 +</​code>​
  
tutorial/lvm.txt · Last modified: 2013/06/26 01:32 by scrosby
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki