Score:0

How do I recover a broken logical volume group?

in flag

I created a logical volume group for my xen VMs on a separate drive. I had them working perfectly. Then I accidentally unplugged the USB cable hosting my vg0. Now my VMs drives cannot be detected.

I can see them.

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

or all of them here:

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

my VM drive is /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

and I used to see the volume group attached to the sdc output from lsblk. But not anymore.

How do I recover drive data from a broken logical volume group?

Diagnostics:

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

I get this error that pertains to the LV drive in question.

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

I am able to reactivate my volume group.

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

But VM still boots to install CD instead of the installed OS.

This is my xen configuration.

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']
berndbausch avatar
us flag
The `# open 0` in the lvdisplay output indicates that the logical volume, and probably the entire volume group have not been activated for some reason. To understand this better, start by running `pvs`, `vgs` and `lvs` to list all your physical volumes, volume groups and logical volumes. There might also be relevant messages in the kernel message buffer (`dmesg` or `journalctl -k`). Also, when searching for "leaked on lvdisplay invocation", I found at least on result saying that this message does not indicate a fundamental problem, but it might be a good idea to research that further.
berndbausch avatar
us flag
And you could try to activate it manually and see what, if any, error message is produced: `vgchange -a y vg0` and/or `lvchange -a y /dev/vg0/lv-vm-debian01`.
in flag
@berndbausch 8 logical volume(s) in volume group "vg0" now active. But my drive still boots to install cd instead of the installed OS. Which means it is still not finding my data
in flag
@berndbausch Server reboot fixed it. Your fix + a reboot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.