1

I have a Ubuntu 16.04 Server and used these two commands which accidently deleted my logical volume:

lvchange -an -v /dev/sda5/xyz-vg and lvremove -vf /dev/sda5/xyz-vg

I did so from an Ubuntu Live CD, in order to decrease the size of the partition where the lv was located using gparted. It would not work otherwise. In the end resizing worked fine, but now I cannot boot anymore.

At startup I get an error message Failed to find logical volume "xyz-vg/root"

sudo pvdisplay from the live CD indicates that the PV is called /dev/sda5 and the VG name is xyz-vg.

sudo lvmdiskscan gives me that I have three partitions of which one is a LVM phyiscal volume.

I followed steps indicated as linked in the comment section here:

  1. pvcreate --restorefile /etc/lvm/archive/ --uuid dev/sdX
  2. vgcfgrestore -f /etc/lvm/archive/ --verbose thisVG
  3. vgdisplay -v /dev/thisVG && vgchange -ay /dev/thisVG
  4. mount /dev/thisVG/missingLV /mnt

This recreated my volume group. The output of vgdisplay from the livecd is now:

root@ubuntu:/home/ubuntu# vgdisplay
  --- Volume group ---
  VG Name               xzy-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               439.45 GiB
  PE Size               4.00 MiB
  Total PE              112499
  Alloc PE / Size       0 / 0   
  Free  PE / Size       112499 / 439.45 GiB
  VG UUID               Ii03eE-fP5g-1Mjm-yC0T-F9Yl-5vqW-XYUBID

However, this still does not bring me back the logical volume. lvdisplay gives no output, so I guess I need to recreate it? How do I do that without deleting all the data that is still on the disk?

joaoal
  • 173
  • 6
  • The lvremove command does not temporarily deactivate a logical volume. It _destroys_ it. – Michael Hampton Jan 22 '19 at 15:30
  • This is a duplicate of this question, which also has an answer that will work for you: https://serverfault.com/questions/263741/recovering-accidentally-destroyed-lvm2-information/264580 – Spooler Jan 22 '19 at 15:30
  • @Spooler Please click the "close" link above to mark a question as a duplicate. – Michael Hampton Jan 22 '19 at 15:35

0 Answers0