LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   LVM Problem (https://www.linuxquestions.org/questions/linux-server-73/lvm-problem-4175502611/)

Bentech 04-22-2014 03:31 PM

LVM Problem
 
Hi,

I've been having some problems with my LVM disk array.

First off i was suspecting a failing hard disk

Code:

smartctl  /dev/sde
# 1 Extended offline Completed: read failure 90% 4861 280578
# 2  Short offline      Completed: read failure      90%      4860        28055778
# 3  Extended offline    Completed: read failure      90%    4860        2805778

I tried correcting this with

Code:

dd if=/dev/zero of=/dev/sde conv=sync bs=4096 count=1 seek=2805778
Repeated till there were no more errors.

I tried mounting the disk but it still had errors. e.g. Input/Output error when trying ls in the directory. (I could access roughly half my files)

--

I was looking around and noticed my other disk /dev/sdf didn't have a partition label.

Code:

Error: Unable to open /dev/sdf - unrecognised disk label.
I Know This Was A Mistake Now But I corrected it with:

Code:

parted /dev/sdf
mklabel gpt

This cleared my lvm info.

I restored it with?

Code:

parted
mkpart primary 0 3000000
set 1 boot on

This made my partition appear again.

I assumed everything was okay as it let me mount my lvm array again.

I knew there were problems with the disk so i preformed

Code:

fsck -C -f -y /dev/LVM_SATA/dvd
I Left this going overnight.


I came back to find half my files missing!

I unmounted the LVM.

I have now tried restoring the LVM from a backup i had made before it all went wrong.


I then restored it with
Code:

pvcreate --uuid I11Uen-ra92-OEt0-h9LZ-Dj9z-l03m-WKapaG --restorefile ./LVM_SATA /dev/sdf1
Now mount gives

Code:

mount: special device /dev/LVM_SATA/dvd does not exist
Code:

sudo blkid/dev/sda1: UUID="IPVKAZ-RO2D-ss8d-OXe7-Pr2r-pJ21-sSlV02" TYPE="LVM2_member"
/dev/sda2: UUID="9hzH98-3Y3S-BY31-bTKO-2W3k-xQxq-jsa3FH" TYPE="LVM2_member"
/dev/sdb1: UUID="fa2fd5bd-39a0-423b-b2e3-55cb228280b1" TYPE="ext4"
/dev/sdb5: UUID="2c4f1c2a-d9cb-487c-a8f7-2836ca3452eb" TYPE="swap"
/dev/sdc1: UUID="z32Xx8-lXBh-1Rr0-XldC-0RCr-geG6-fe8ow2" TYPE="LVM2_member"
/dev/sdd1: UUID="9EjM3Z-igOx-I8P5-mdW2-hkdp-iieI-e2uJzo" TYPE="LVM2_member"
/dev/sde1: UUID="gYDc1O-333e-5eoh-yl4n-FfgW-UBlq-4XK3TL" TYPE="LVM2_member"
/dev/sdf1: UUID="I11Uen-ra92-OEt0-h9LZ-Dj9z-l03m-WKapaG" TYPE="LVM2_member"



Code:

cat ./LVM_SATA
# Generated by LVM2 version 2.02.66(2) (2010-05-20): Tue Apr 22 08:39:34 2014


contents = "Text Format Volume Group"
version = 1


description = "vgcfgbackup -f /root/LVM_SATA LVM_SATA"


creation_host = "mythserver.local"      # Linux mythserver.local 3.8.0-35-generic #52~precise1-Ubuntu SMP Thu Jan 30 17:27:28 UTC 2014 i686
creation_time = 1398152374      # Tue Apr 22 08:39:34 2014


LVM_SATA {
        id = "xCkZNm-PyI0-3ANq-PRkR-OEk2-Xcmm-CK3L90"
        seqno = 48
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0


        physical_volumes {


                pv0 {
                        id = "9EjM3Z-igOx-I8P5-mdW2-hkdp-iieI-e2uJzo"
                        device = "/dev/sdd1"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 2930272002  # 1.36451 Terabytes
                        pe_start = 384
                        pe_count = 357699      # 1.36451 Terabytes
                }


                pv1 {
                        id = "gYDc1O-333e-5eoh-yl4n-FfgW-UBlq-4XK3TL"
                        device = "/dev/sdg1"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 2930272002  # 1.36451 Terabytes
                        pe_start = 384
                        pe_count = 357699      # 1.36451 Terabytes
                }


                pv2 {
                        id = "z32Xx8-lXBh-1Rr0-XldC-0RCr-geG6-fe8ow2"
                        device = "/dev/sdc1"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907026560  # 1.81935 Terabytes
                        pe_start = 384
                        pe_count = 476931      # 1.81935 Terabytes
                }


                pv3 {
                        id = "9hzH98-3Y3S-BY31-bTKO-2W3k-xQxq-jsa3FH"
                        device = "/dev/sda2"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 882269824    # 420.699 Gigabytes
                        pe_start = 384
                        pe_count = 107698      # 420.695 Gigabytes
                }


                pv4 {
                        id = "IPVKAZ-RO2D-ss8d-OXe7-Pr2r-pJ21-sSlV02"
                        device = "/dev/sda1"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 2048004096  # 976.564 Gigabytes
                        pe_start = 384
                        pe_count = 250000      # 976.562 Gigabytes
                }


                pv5 {
                        id = "I11Uen-ra92-OEt0-h9LZ-Dj9z-l03m-WKapaG"
                        device = "/dev/sdf1"    # Hint only


                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 5860532784  # 2.72902 Terabytes
                        pe_start = 384
                        pe_count = 715397      # 2.72902 Terabytes
                }
        }


        logical_volumes {


                dvd {
                        id = "M8Nxb5-OfH1-iOiq-Q2Wr-1cHa-hqAz-vwXcIa"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        segment_count = 6


                        segment1 {
                                start_extent = 0
                                extent_count = 357699  # 1.36451 Terabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv0", 0
                                ]
                        }
                        segment2 {
                                start_extent = 357699
                                extent_count = 357699  # 1.36451 Terabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv1", 0
                                ]
                        }
                        segment3 {
                                start_extent = 715398
                                extent_count = 476931  # 1.81935 Terabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv2", 0
                                ]
                        }
                        segment4 {
                                start_extent = 1192329
                                extent_count = 107698  # 420.695 Gigabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv3", 0
                                ]
                        }
                        segment5 {
                                start_extent = 1300027
                                extent_count = 250000  # 976.562 Gigabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv4", 0
                                ]
                        }
                        segment6 {
                                start_extent = 1550027
                                extent_count = 715397  # 2.72902 Terabytes


                                type = "striped"
                                stripe_count = 1        # linear


                                stripes = [
                                        "pv5", 0
                                ]
                        }
                }
        }
}


berndbausch 04-23-2014 07:51 PM

Quote:

Originally Posted by Bentech (Post 5157313)
Hi,

I've been having some problems with my LVM disk array.

First off i was suspecting a failing hard disk

[CODE]smartctl /dev/sde

According to the LVM_SATA file, /dev/sde is not part of that volume group, so I guess your problems with /dev/sde are unrelated to the rest.

Quote:

Code:

parted /dev/sdf
mklabel gpt

This cleared my lvm info.
Not really. Since the partitioning information was gone, /dev/sdf1 didn't exist anymore, and LVM could find this physical volume. The information is still on the disk.
Quote:

I restored it with?

Code:

parted
mkpart primary 0 3000000
set 1 boot on


Well, you recreated a partition /dev/sdf1, and LVM can now access the previously missing physical volume again. If /dev/sdf1 is however not at the exact same location or doesn't have the same size as before, there will be trouble.
Quote:

I then restored it with
Code:

pvcreate --uuid I11Uen-ra92-OEt0-h9LZ-Dj9z-l03m-WKapaG --restorefile ./LVM_SATA /dev/sdf1
Now mount gives

Code:

mount: special device /dev/LVM_SATA/dvd does not exist

What does vgdisplay -v LVM_SATA tell you?

You might be better off just recreating the whole volume group with vgcfgrestore.


All times are GMT -5. The time now is 01:33 PM.