如何恢复损坏的逻辑卷组?

如何恢复损坏的逻辑卷组?

我在单独的驱动器上为我的 xen VM 创建了一个逻辑卷组。它们运行正常。然后我不小心拔掉了托管 vg0 的 USB 电缆。现在无法检测到我的 VM 驱动器。

我能看到它们。

root@bradNewInspiron15:/etc/xen# lvdisplay -v /dev/vg0/lv-vm-debian01 
File descriptor 58 (/run/user/1000/gnome-shell-disable-extensions (deleted)) leaked on lvdisplay invocation. Parent PID 4855: bash
File descriptor 84 (/home/brad/.local/share/gvfs-metadata/home (deleted)) leaked on lvdisplay invocation. Parent PID 4855: bash
File descriptor 85 (/home/brad/.local/share/gvfs-metadata/home-aa10c3e6.log (deleted)) leaked on lvdisplay invocation. Parent PID 4855: bash
File descriptor 87 (/home/brad/.local/share/gvfs-metadata/trash:) leaked on lvdisplay invocation. Parent PID 4855: bash
File descriptor 88 (/home/brad/.local/share/gvfs-metadata/trash:-7372c3e8.log) leaked on lvdisplay invocation. Parent PID 4855: bash
  --- Logical volume ---
  LV Path                /dev/vg0/lv-vm-debian01
  LV Name                lv-vm-debian01
  VG Name                vg0
  LV UUID                loZ0jx-cdot-58kJ-QlaJ-4tdD-JpGO-581s8H
  LV Write Access        read/write
  LV Creation host, time bradNewInspiron15, 2021-06-13 07:00:33 -0500
  LV Status              available
  # open                 0
  LV Size                15.00 GiB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:7

或者全部在这里:

root@bradNewInspiron15:/etc/xen# ls /dev/vg0
lv-vm-debian01  lv-vm-debian02  lv-vm-mint01  lv-vm-mint02  lv-vm-suse01  lv-vm-suse02  lv-vm-ubuntu01  lv-vm-ubuntu02

我的 VM 驱动器是 /dev/sdc

root@bradNewInspiron15:/etc/xen# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0   9.1M  1 loop /snap/canonical-livepatch/98
loop1    7:1    0  16.9M  1 loop /snap/mcpelauncher-thesonicmaster/12
loop2    7:2    0   9.1M  1 loop /snap/canonical-livepatch/99
loop3    7:3    0  99.2M  1 loop /snap/core/11167
loop4    7:4    0 141.5M  1 loop /snap/chromium/1637
loop5    7:5    0  55.4M  1 loop /snap/core18/2066
loop7    7:7    0  77.2M  1 loop /snap/discord/128
loop8    7:8    0   219M  1 loop /snap/gnome-3-34-1804/72
loop9    7:9    0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
loop10   7:10   0  32.1M  1 loop /snap/snapd/12057
loop11   7:11   0  16.9M  1 loop /snap/mcpelauncher-thesonicmaster/10
loop12   7:12   0    51M  1 loop /snap/snap-store/547
loop13   7:13   0  64.8M  1 loop /snap/gtk-common-themes/1514
loop14   7:14   0    51M  1 loop /snap/snap-store/542
loop15   7:15   0  65.1M  1 loop /snap/gtk-common-themes/1515
loop16   7:16   0  76.7M  1 loop /snap/discord/122
loop17   7:17   0 162.9M  1 loop /snap/gnome-3-28-1804/145
loop18   7:18   0  99.4M  1 loop /snap/core/11187
loop19   7:19   0  55.5M  1 loop /snap/core18/1997
loop20   7:20   0   219M  1 loop /snap/gnome-3-34-1804/66
loop21   7:21   0  32.3M  1 loop /snap/snapd/12159
loop22   7:22   0 141.5M  1 loop /snap/chromium/1646
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   480M  0 part 
└─sda2   8:2    0   931G  0 part /
sdc      8:32   0 931.5G  0 disk 
└─sdc1   8:33   0 931.5G  0 part

我以前经常在 lsblk 输出中看到附加到 sdc 的卷组。但现在再也看不到了。

如何从损坏的逻辑卷组恢复驱动器数据?

诊断:

root@bradNewInspiron15:/etc/xen# pvs
File descriptor 58 (/run/user/1000/gnome-shell-disable-extensions (deleted)) leaked on pvs invocation. Parent PID 4855: bash
File descriptor 84 (/home/brad/.local/share/gvfs-metadata/home (deleted)) leaked on pvs invocation. Parent PID 4855: bash
File descriptor 85 (/home/brad/.local/share/gvfs-metadata/home-aa10c3e6.log (deleted)) leaked on pvs invocation. Parent PID 4855: bash
File descriptor 87 (/home/brad/.local/share/gvfs-metadata/trash:) leaked on pvs invocation. Parent PID 4855: bash
File descriptor 88 (/home/brad/.local/share/gvfs-metadata/trash:-7372c3e8.log) leaked on pvs invocation. Parent PID 4855: bash
  PV         VG  Fmt  Attr PSize    PFree   
  /dev/sdc1  vg0 lvm2 a--  <931.51g <811.51g
root@bradNewInspiron15:/etc/xen# vgs
File descriptor 58 (/run/user/1000/gnome-shell-disable-extensions (deleted)) leaked on vgs invocation. Parent PID 4855: bash
File descriptor 84 (/home/brad/.local/share/gvfs-metadata/home (deleted)) leaked on vgs invocation. Parent PID 4855: bash
File descriptor 85 (/home/brad/.local/share/gvfs-metadata/home-aa10c3e6.log (deleted)) leaked on vgs invocation. Parent PID 4855: bash
File descriptor 87 (/home/brad/.local/share/gvfs-metadata/trash:) leaked on vgs invocation. Parent PID 4855: bash
File descriptor 88 (/home/brad/.local/share/gvfs-metadata/trash:-7372c3e8.log) leaked on vgs invocation. Parent PID 4855: bash
  VG  #PV #LV #SN Attr   VSize    VFree   
  vg0   1   8   0 wz--n- <931.51g <811.51g
root@bradNewInspiron15:/etc/xen# lvs
File descriptor 58 (/run/user/1000/gnome-shell-disable-extensions (deleted)) leaked on lvs invocation. Parent PID 4855: bash
File descriptor 84 (/home/brad/.local/share/gvfs-metadata/home (deleted)) leaked on lvs invocation. Parent PID 4855: bash
File descriptor 85 (/home/brad/.local/share/gvfs-metadata/home-aa10c3e6.log (deleted)) leaked on lvs invocation. Parent PID 4855: bash
File descriptor 87 (/home/brad/.local/share/gvfs-metadata/trash:) leaked on lvs invocation. Parent PID 4855: bash
File descriptor 88 (/home/brad/.local/share/gvfs-metadata/trash:-7372c3e8.log) leaked on lvs invocation. Parent PID 4855: bash
  LV             VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-vm-debian01 vg0 -wi-a----- 15.00g                                                    
  lv-vm-debian02 vg0 -wi-a----- 15.00g                                                    
  lv-vm-mint01   vg0 -wi-a----- 15.00g                                                    
  lv-vm-mint02   vg0 -wi-ao---- 15.00g                                                    
  lv-vm-suse01   vg0 -wi-a----- 15.00g                                                    
  lv-vm-suse02   vg0 -wi-a----- 15.00g                                                    
  lv-vm-ubuntu01 vg0 -wi-a----- 15.00g                                                    
  lv-vm-ubuntu02 vg0 -wi-a----- 15.00g

我收到与所讨论的 LV 驱动器有关的错误。

Jun 19 22:43:54 bradNewInspiron15 kernel: Buffer I/O error on dev dm-7, logical block 0, async page read

我可以重新激活我的卷组。

root@bradNewInspiron15:/etc/xen# vgchange -a y vg0
File descriptor 58 (/run/user/1000/gnome-shell-disable-extensions (deleted)) leaked on vgchange invocation. Parent PID 4855: bash
File descriptor 84 (/home/brad/.local/share/gvfs-metadata/home (deleted)) leaked on vgchange invocation. Parent PID 4855: bash
File descriptor 85 (/home/brad/.local/share/gvfs-metadata/home-aa10c3e6.log (deleted)) leaked on vgchange invocation. Parent PID 4855: bash
File descriptor 87 (/home/brad/.local/share/gvfs-metadata/trash:) leaked on vgchange invocation. Parent PID 4855: bash
File descriptor 88 (/home/brad/.local/share/gvfs-metadata/trash:-7372c3e8.log) leaked on vgchange invocation. Parent PID 4855: bash
  8 logical volume(s) in volume group "vg0" now active

但是 VM 仍然启动到安装 CD,而不是启动到已安装的操作系统。

这是我的 xen 配置。

root@bradNewInspiron15:/etc/xen# xl create lv-vm-debian01.cfg           
Parsing config from lv-vm-debian01.cfg
root@bradNewInspiron15:/etc/xen# cat create lv-vm-debian01.cfg   
cat: create: No such file or directory
#
# Configuration file for the Xen instance lv-vm-debian01, created
# by xen-tools 4.8 on Sat Jun 12 23:23:36 2021.
#
builder = "hvm"

bootloader = 'pygrub'

vcpus       = '2'
memory      = '3144'

disk        = [
                  'phy:/dev/vg0/lv-vm-debian01,xvda,rw',
                  'file:/home/brad/Downloads/debian-10.9.0-amd64-netinst.iso,xvdb:cdrom,r'
              ]
name        = 'hvm-debian01'
dhcp        = 'dhcp'
vif         = [ 'type=ioemu, model=e1000, bridge=br0' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

# Set boot order (d = CDROM, c = HDD)
#boot = "dc"
boot = "c"

# Use VESA-compliant display with more VRAM
vga = "stdvga"
videoram = 64

# Use VNC for display
vnc = 1
vncconsole=1
#vnclisten = "*"
vncdisplay = 0  
vncpasswd  = "hahaha"
usbdevice=['tablet']

相关内容