恢复LVM元数据,填充元数据后修复失败

恢复LVM元数据,填充元数据后修复失败

我有一个 lvm,其中元数据已满,我不明白出了什么问题,并尝试使用以下命令修复它

lvconvert --repair pve/data

事实证明这是一个坏主意,因为它现在显示没有任何 lv 的数据。类似这个问题LVM:修复失败后如何恢复 LVM 精简池/卷?,但我从未尝试过扩展元数据,并且我无法使该解决方案发挥作用。

经过我的研究后,我似乎可以从存档中恢复元数据。这是 ProxMox 安装,因此所有东西都是 vm 驱动器。有一个“运行 lvconvert --repair 之前”的存档文件。还有一个用于 vmdisk 的“before lvcreate”文件,我不关心该文件。我知道 LVM 在我创建该磁盘后工作了几个月。因此,如果可以使用它来保存其余数据,那是完全可以接受的。此时,我正在尝试减少数据丢失,而不是让池按其应有的方式运行。

因此,我已将磁盘克隆到一个新的(更大的)磁盘,以dd确保此处的安全。我尝试使用此命令使用实时图像从存档中恢复

lvchange -an pvm
pvcreate --uuid "z34DFR-Kkk6-4P5m-N1uy-n7dh-sI11-ABuxCl" --restorefile /etc/lvm/archive/pve_00064-1664281480.vg /dev/sda

但这给了

Couldn't find device with uuid z34DFR-Kkk6-4P5m-N1uy-n7dh-sI11-ABuxCl.
UUID z34DFR-Kkk6-4P5m-N1uy-n7dh-sI11-ABuxCl already in use on "/dev/sda3".

以下是有关 LVM 和磁盘的一些信息。/dev/sdb目前是 的克隆/dev/sda

root@frank:~# fdisk -l
Disk /dev/sda: 1.8 TiB, 1999844147200 bytes, 3905945600 sectors
Disk model: PERC 6/i        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: EAE945C0-902E-4C35-8544-F5D0BE412BF3

Device       Start        End    Sectors  Size Type
/dev/sda1       34       2047       2014 1007K BIOS boot
/dev/sda2     2048    1050623    1048576  512M EFI System
/dev/sda3  1050624 3905945566 3904894943  1.8T Linux LVM


Disk /dev/sdb: 5.5 TiB, 5999532441600 bytes, 11717836800 sectors
Disk model: PERC 6/i        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1D53AC81-30BC-BF46-BEA9-B61C0FF235DF

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 5859377151 5859375104  2.7T Linux filesystem


Disk /dev/mapper/pve-swap: 8 GiB, 8589934592 bytes, 16777216 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/pve-root: 128 GiB, 137438953472 bytes, 268435456 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/pve-data_meta0: 15 GiB, 16106127360 bytes, 31457280 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
root@frank:~# pvs -a
  PV         VG  Fmt  Attr PSize  PFree  
  /dev/sda2           ---      0       0 
  /dev/sda3  pve lvm2 a--  <1.82t 211.00g
  /dev/sdb1           ---      0       0 

root@frank:~# vgs -a
  VG  #PV #LV #SN Attr   VSize  VFree  
  pve   1  21   0 wz--n- <1.82t 211.00g
    
root@frank:~# lvs -a
  LV              VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data            pve twi-aotz--  <1.44t             0.00   0.15                            
  data_meta0      pve -wi-a-----  15.00g                                                    
  [data_tdata]    pve Twi-ao----  <1.44t                                                    
  [data_tmeta]    pve ewi-ao----  15.00g                                                    
  [lvol1_pmspare] pve ewi-------  15.00g                                                    
  root            pve -wi-ao---- 128.00g                                                    
  swap            pve -wi-ao----   8.00g                                                    
  vm-100-disk-0   pve Vwi---tz--   8.00g data                                               
  vm-201-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-205-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-300-disk-0   pve Vwi---tz--  24.00g data                                               
  vm-301-disk-0   pve Vwi---tz--  32.00g data                                               
  vm-302-disk-0   pve Vwi---tz--  64.00g data                                               
  vm-400-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-401-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-402-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-403-disk-0   pve Vwi---tz-- 128.00g data                                               
  vm-404-disk-0   pve Vwi---tz-- 256.00g data                                               
  vm-506-disk-0   pve Vwi---tz--  32.00g data                                               
  vm-508-disk-0   pve Vwi---tz-- 800.00g data                                               
  vm-508-disk-1   pve Vwi---tz--  24.00g data                                               
  vm-600-disk-0   pve Vwi---tz--  16.00g data                                               
  vm-601-disk-0   pve Vwi---tz--  16.00g data                                               
  vm-602-disk-0   pve Vwi---tz--  32.00g data  
root@frank:~# pvscan
  PV /dev/sda3   VG pve             lvm2 [<1.82 TiB / 211.00 GiB free]
  Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0   ]

root@frank:~# lvscan
  ACTIVE            '/dev/pve/swap' [8.00 GiB] inherit
  ACTIVE            '/dev/pve/root' [128.00 GiB] inherit
  ACTIVE            '/dev/pve/data' [<1.44 TiB] inherit
  inactive          '/dev/pve/vm-100-disk-0' [8.00 GiB] inherit
  inactive          '/dev/pve/vm-201-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-600-disk-0' [16.00 GiB] inherit
  inactive          '/dev/pve/vm-601-disk-0' [16.00 GiB] inherit
  inactive          '/dev/pve/vm-506-disk-0' [32.00 GiB] inherit
  inactive          '/dev/pve/vm-602-disk-0' [32.00 GiB] inherit
  inactive          '/dev/pve/vm-205-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-300-disk-0' [24.00 GiB] inherit
  inactive          '/dev/pve/vm-508-disk-0' [800.00 GiB] inherit
  inactive          '/dev/pve/vm-508-disk-1' [24.00 GiB] inherit
  inactive          '/dev/pve/vm-400-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-401-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-402-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-403-disk-0' [128.00 GiB] inherit
  inactive          '/dev/pve/vm-301-disk-0' [32.00 GiB] inherit
  inactive          '/dev/pve/vm-302-disk-0' [64.00 GiB] inherit
  inactive          '/dev/pve/vm-404-disk-0' [256.00 GiB] inherit
  ACTIVE            '/dev/pve/data_meta0' [15.00 GiB] inherit

root@frank:~# vgdisplay 
  --- Volume group ---
  VG Name               pve
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  125
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                21
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <1.82 TiB
  PE Size               4.00 MiB
  Total PE              476671
  Alloc PE / Size       422655 / 1.61 TiB
  Free  PE / Size       54016 / 211.00 GiB
  VG UUID               H0G0xv-ddq1-BdvI-fIxF-dg8e-BT2X-CqYWFX

非常感谢您对此的任何答案或提示。正如我所提到的,数据恢复开始成为首要任务。如果我能够提供更多的东西,以便更容易提供提示,我会的!

相关内容