Diagnosing missing logical volume

Ryan Germann asked:

I set up an Open Media Vault server with 4 physical discs, a single physical volume and single volume group, and a single logical volume, all called “Fantasia”. This isn’t RAID and isn’t encrypted.

I tried adding an external 4-drive enclosure via eSATA, and discovered the hard way that the eSATA on the motherboard doesn’t support port replication.

At any rate, the current state of things is:
– pvscan returns promising results
– vgscan returns promising results
– lvscan returns no output: just a command prompt no message of any kind.

vgscan returns “Found volume group Fantasia” using metadata type lvm2″

when I attempt to vgchange -a y on the “Fantasia” logical volume, it returns

“0 logical volume(s) in volume group “Fantasia” now active”

I’m pretty sure I want that number to be greater than zero.

At risk of making this post unreadable and useless, I haven’t posted the output of various commands… if anyone could help me out here, I’m confident that the data is still on the disks: they weren’t formatted just disconnected and when reconnected, aren’t recognized. I’ve spent a lot of hours googling etc. and while I do find some useful information i.e. commands to get status etc., I’m wary of executing certain commands that I’m not certain will leave the data on the disk recoverable.

I’m hopeful that all that’s wrong is some config file got wiped out, but the data is still in tact, and would sure appreciate it if someone could guide me through the steps from scratch… I think the kind of process that might work would be as though I was moving physical drives from one system to another and wanted all the disks, physical volumes, volume group, and logical volumes to be accessed on that new system.

It’s not videos of baby’s first steps or anything irreplaceable, but better to recover it go through the effort to replace it, if it can be recovered… so any help would be greatly appreciated.

edit: here is the output of pvscan, pvs, vgscan, and vgs. lvscan and lvs have no output.

# pvscan
  PV /dev/sda   VG Fantasia        lvm2 [1.82 TiB / 1.82 TiB free]
  PV /dev/sdc   VG Fantasia        lvm2 [1.82 TiB / 1.82 TiB free]
  PV /dev/sdd   VG Fantasia        lvm2 [1.82 TiB / 1.82 TiB free]
  PV /dev/sde   VG Fantasia        lvm2 [3.64 TiB / 3.64 TiB free]
  PV /dev/sdf   VG Fantasia        lvm2 [3.64 TiB / 3.64 TiB free]
  Total: 5 [12.74 TiB] / in use: 5 [12.74 TiB] / in no VG: 0 [0   ]

# pvs
  PV         VG       Fmt  Attr PSize PFree
  /dev/sda   Fantasia lvm2 a--  1.82t 1.82t
  /dev/sdc   Fantasia lvm2 a--  1.82t 1.82t
  /dev/sdd   Fantasia lvm2 a--  1.82t 1.82t
  /dev/sde   Fantasia lvm2 a--  3.64t 3.64t
  /dev/sdf   Fantasia lvm2 a--  3.64t 3.64t

# vgscan
  Reading volume groups from cache.
  Found volume group "Fantasia" using metadata type lvm2

# vgs
  VG       #PV #LV #SN Attr   VSize  VFree
  Fantasia   5   0   0 wz--n- 12.74t 12.74t

here’s what testdisk shows:

Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 2000 GB / 1863 GiB - ST2000DL003-9VT166
 Disk /dev/sdb - 15 GB / 14 GiB - Generic- SD/MMC
 Disk /dev/sdc - 2000 GB / 1863 GiB - ST2000DM006-2DM164
 Disk /dev/sdd - 2000 GB / 1863 GiB - ST2000DM001-1ER164
 Disk /dev/sde - 4000 GB / 3726 GiB - ST4000DM000-2AE166
 Disk /dev/sdf - 4000 GB / 3726 GiB - WDC WD40EFRX-68N32N0

“Analyze” on one disk (all disks return similar result)

Disk /dev/sda - 2000 GB / 1863 GiB - ST2000DL003-9VT166

Please select the partition table type, press Enter when done.
 [Intel  ] Intel/PC partition
 [EFI GPT] EFI GPT partition map (Mac i386, some x86_64...)
 [Humax  ] Humax partition table
 [Mac    ] Apple partition map
>[None   ] Non partitioned media
 [Sun    ] Sun Solaris partition
 [XBox   ] XBox partition
 [Return ] Return to disk selection
Disk /dev/sda - 2000 GB / 1863 GiB - CHS 243201 255 63
     Partition               Start        End    Size in sectors
>P Linux LVM2               0   0  1 243201  80 63 3907029168

Structure: OK

Doing a “Deeper search” takes quite a while but returns these results immediately:

Disk /dev/sda - 2000 GB / 1863 GiB - CHS 243201 255 63
Analyse cylinder   280/243200: 00%


  Linux LVM2               0   0  1 243201  80 63 3907029168
  ext2                     0  38 13     4  58 28      65536
  ext2                     0  38 13     4  58 28      65536
  ext2                     0  38 15     4  58 30      65536
  ext2                    32   7 16    36  27 31      65536

contents of the /dev/mapper/ directory:

/dev/mapper# ls -la
total 0
drwxr-xr-x  2 root root      60 Jun  3 01:44 .
drwxr-xr-x 18 root root    3420 Jun  3 01:46 ..
crw-------  1 root root 10, 236 Jun  3 09:01 control

pvdisplay -m output:

# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               Fantasia
  PV Size               1.82 TiB / not usable 936.00 KiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              476932
  Free PE               476932
  Allocated PE          0
  PV UUID               Nl0vqx-Dggu-4d2I-h5MB-NuoV-CIoM-9Lk7Ye

  --- Physical Segments ---
  Physical extent 0 to 476931:
    FREE

  --- Physical volume ---
  PV Name               /dev/sdd
  VG Name               Fantasia
  PV Size               1.82 TiB / not usable 1.09 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              476932
  Free PE               476932
  Allocated PE          0
  PV UUID               VDTFqS-vjAB-kBdf-LI5i-310v-Hs2c-KX9jYs

  --- Physical Segments ---
  Physical extent 0 to 476931:
    FREE

  --- Physical volume ---
  PV Name               /dev/sde
  VG Name               Fantasia
  PV Size               1.82 TiB / not usable 1.09 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              476932
  Free PE               476932
  Allocated PE          0
  PV UUID               hYlB6v-Vkrn-hUNa-JVRK-zbOf-9Lca-Ps1JDL

  --- Physical Segments ---
  Physical extent 0 to 476931:
    FREE

  --- Physical volume ---
  PV Name               /dev/sdf
  VG Name               Fantasia
  PV Size               3.64 TiB / not usable 3.84 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              953861
  Free PE               953861
  Allocated PE          0
  PV UUID               2d5MB9-J6xH-B80B-lVoQ-Nde9-9CQ1-jxIusp

  --- Physical Segments ---
  Physical extent 0 to 953860:
    FREE

  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               Fantasia
  PV Size               3.64 TiB / not usable 2.84 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              953861
  Free PE               953861
  Allocated PE          0
  PV UUID               YKOqsg-Wkx7-f0f3-ko2J-UeX3-YgFO-6ow0QL

  --- Physical Segments ---
  Physical extent 0 to 953860:
    FREE

output of what I believe to be the last known good lvm file, from /etc/lvm/archive:

# Generated by LVM2 version 2.02.168(2) (2016-11-30): Sat May  4 17:08:11 2019

contents = "Text Format Volume Group"
version = 1

description = "Created *before* executing 'vgextend Fantasia /dev/sdf'"

creation_host = "fantasia"      # Linux fantasia 4.19.0-0.bpo.4-amd64 #1 SMP Debian 4.19.28-2~bpo9+1 (2019-03-27) x86_64
creation_time = 1557004091      # Sat May  4 17:08:11 2019

Fantasia {
        id = "TPmx5a-MY9Y-gtTS-RwTU-wNFG-EXwU-4PhQDt"
        seqno = 6
        format = "lvm2"                 # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "Nl0vqx-Dggu-4d2I-h5MB-NuoV-CIoM-9Lk7Ye"
                        device = "/dev/sda"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907027120   # 1.81935 Terabytes
                        pe_start = 2048
                        pe_count = 476932       # 1.81935 Terabytes
                }

                pv1 {
                        id = "VDTFqS-vjAB-kBdf-LI5i-310v-Hs2c-KX9jYs"
                        device = "/dev/sdb"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 3907027120   # 1.81935 Terabytes
                        pe_start = 2048
                        pe_count = 476932       # 1.81935 Terabytes
                }

                pv2 {
                        id = "hYlB6v-Vkrn-hUNa-JVRK-zbOf-9Lca-Ps1JDL"
                        device = "/dev/sdc"     # Hint only

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

                pv3 {
                        id = "2d5MB9-J6xH-B80B-lVoQ-Nde9-9CQ1-jxIusp"
                        device = "/dev/sde"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 7814037168   # 3.63869 Terabytes
                        pe_start = 2048
                        pe_count = 953861       # 3.63869 Terabytes
                }

                pv4 {
                        id = "YKOqsg-Wkx7-f0f3-ko2J-UeX3-YgFO-6ow0QL"
                        device = "[unknown]"    # Hint only

                        status = ["ALLOCATABLE"]
                        flags = ["MISSING"]
                        dev_size = 7814037168   # 3.63869 Terabytes
                        pe_start = 2048
                        pe_count = 953861       # 3.63869 Terabytes
                }
        }

        logical_volumes {

                Fantasia {
                        id = "lhBS6X-W01J-0iyK-cDpN-Unl9-ALtS-dTMm1t"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        creation_time = 1490757300      # 2017-03-28 23:15:00 -0400
                        creation_host = "Fantasia"
                        segment_count = 5

                        segment1 {
                                start_extent = 0
                                extent_count = 953861   # 3.63869 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv3", 0
                                ]
                        }
                        segment2 {
                                start_extent = 953861
                                extent_count = 476932   # 1.81935 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 0
                                ]
                        }
                        segment3 {
                                start_extent = 1430793
                                extent_count = 476932   # 1.81935 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv1", 0
                                ]
                        }
                        segment4 {
                                start_extent = 1907725
                                extent_count = 476932   # 1.81935 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv2", 0
                                ]
                        }
                        segment5 {
                                start_extent = 2384657
                                extent_count = 953861   # 3.63869 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

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

}

My answer:


Your output indicates that a volume group named Fantasia exists, spanning all six disks, but doesn’t contain any logical volumes.

The archive file seems to describe a logical volume named Fantasia in a volume group of the same name.

I can’t say how your LV got deleted, but since you have the archive file you should be able to use vgcfgrestore to restore it, for example:

vgcfgrestore -f /etc/lvm/archive/Fantasia-00000-whatever.vg Fantasia

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.