诊断丢失的逻辑卷

诊断丢失的逻辑卷

编辑:系统从 16 GB 的 USB 密钥启动。

显然,在某个时候,启动设备的“设备名称”(如果我使用该术语不正确,请原谅)发生了变化。从 /dev/sde 到 /dev/sdb 再到 /dev/sdc

/etc/lvm/archives 中最旧的 .vg 文件(在我添加新的 4 TB 驱动器之前)显示 LV 由 /dev/sda /dev/sdb /dev/sdc /dev/sdd 组成

一个稍微不那么旧的 .vg(添加新的 4 TB 驱动器后)文件显示 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sdf

由此我推断,启动 USB Key 的设备名称曾经是 /dev/sde

当我检查 /dev/disk/by-id 中设备的“指针”时,我发现显然是启动 USB 密钥的东西现在是 /dev/sdc

这是 /dev/disk/by-id 的内容

ata-ST2000DL003-9VT166_5YD6LVYG -> ../../sdb
ata-ST2000DM001-1ER164_Z4Z0MPSR -> ../../sde
ata-ST2000DM006-2DM164_Z5609YHK -> ../../sdd
ata-ST4000DM000-2AE166_WDH0ZQSE -> ../../sdf
ata-WDC_WD40EFRX-68N32N0_WD-WCC7K3NKYTA1 -> ../../sda
lvm-pv-uuid-2d5MB9-J6xH-B80B-lVoQ-Nde9-9CQ1-jxIusp -> ../../sdf
lvm-pv-uuid-hYlB6v-Vkrn-hUNa-JVRK-zbOf-9Lca-Ps1JDL -> ../../sde
lvm-pv-uuid-Nl0vqx-Dggu-4d2I-h5MB-NuoV-CIoM-9Lk7Ye -> ../../sdb
lvm-pv-uuid-VDTFqS-vjAB-kBdf-LI5i-310v-Hs2c-KX9jYs -> ../../sdd
lvm-pv-uuid-YKOqsg-Wkx7-f0f3-ko2J-UeX3-YgFO-6ow0QL -> ../../sda
usb-Generic-_SD_MMC_20090815198100000-0:0 -> ../../sdc
usb-Generic-_SD_MMC_20090815198100000-0:0-part1 -> ../../sdc1
usb-Generic-_SD_MMC_20090815198100000-0:0-part2 -> ../../sdc2
usb-Generic-_SD_MMC_20090815198100000-0:0-part5 -> ../../sdc5

我不知道或不关心这是如何发生的,我想知道 UUID 是否以某种方式“嵌入”到物理驱动器或逻辑卷中?我是否需要担心 /dev/disk/by-id 中列出的内容与磁盘上的内容“不一样”?我可以确信“分配”的内容是正确的吗,还是系统在此处显示的内容就是分配的内容?如果驱动器存在,并且此映射是分配 UUID 的方式等,如果我正确制作了 .vg 文件,我可以让一切恢复正常吗?

---原文如下---

我设置了一个 Open Media Vault 服务器,它有 4 个物理磁盘、一个物理卷、一个卷组和一个逻辑卷,都称为“Fantasia”。这不是 RAID,也没有加密。

我尝试通过 eSATA 添加外部 4 驱动器外壳,但却发现主板上的 eSATA 不支持端口复制。

无论如何,目前的情况是: - pvscan 返回有希望的结果 - vgscan 返回有希望的结果 - lvscan 没有返回输出:只是一个命令提示符,没有任何类型的消息。

vgscan 使用元数据类型 lvm2 返回“找到卷组 Fantasia”

当我尝试在“Fantasia”逻辑卷上使用 vgchange -ay 时,它返回

“卷组“Fantasia”中的 0 个逻辑卷现在处于活动状态”

我很确定我希望该数字大于零。

冒着让这篇文章难以阅读和毫无用处的风险,我没有发布各种命​​令的输出...如果有人能在这里帮我,我相信数据仍然在磁盘上:它们没有被格式化,只是断开了连接,重新连接时无法识别。我花了很多时间在谷歌上搜索等等。虽然我确实找到了一些有用的信息,即获取状态的命令等,但我对执行某些命令持谨慎态度,因为我不确定这些命令是否会让磁盘上的数据可恢复。

我希望所有的错误都是一些配置文件被删除了,但数据仍然完好无损,如果有人能指导我从头开始完成这些步骤,我将不胜感激...我认为可能起作用的过程就像我将物理驱动器从一个系统移动到另一个系统,并希望在新系统上访问所有磁盘、物理卷、卷组和逻辑卷。

这不是婴儿第一步的视频或任何不可替代的东西,但最好尽力恢复它,如果可以恢复的话......所以任何帮助都将不胜感激。

编辑:这是 pvscan、pvs、vgscan 和 vgs 的输出。lvscan 和 lvs 没有输出。

# 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

以下是 testdisk 显示的内容:

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

在一个磁盘上“分析”(所有磁盘都返回类似的结果)

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

进行“更深入的搜索”需要相当长的时间,但会立即返回以下结果:

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

/dev/mapper/ 目录的内容:

/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输出:

# 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

我相信这是最后一个已知良好的 lvm 文件的输出,来自 /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
                                ]
                        }
                }
        }

}

答案1

您的输出表明存在一个名为 Fantasia 的卷组,跨越所有六个磁盘,但不包含任何逻辑卷。

该档案文件似乎描述了同名卷组中名为 Fantasia 的逻辑卷。

我无法说清楚你的 LV 是如何被删除的,但是因为你有存档文件,所以你应该能够使用vgcfgrestore它来恢复它,例如:

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

相关内容