[linux-lvm] recover volume group & locical volumes from PV?
zkabelac at redhat.com
Mon May 13 08:37:39 UTC 2019
Dne 12. 05. 19 v 0:52 "Rainer Fügenstein" napsal(a):
> I am (was) using Fedora 28 installed in several LVs on /dev/sda5 (= PV),
> where sda is a "big" SSD.
> by accident, I attached (via SATA hot swap bay) an old harddisk
> (/dev/sdc1), which was used about 2 months temporarily to move the volume
> group / logical volumes from the "old" SSD to the "new" SSD (pvadd,
> pvmove, ...)
I don't understand how this could have happened by accident.
lvm2 provides strong detection of duplicated devices.
It also detects older metadata.
So you would have to put in 'exact' but just old 'copy' of your device
and at the same time drop out the original one - is that what you've made ??
> this combination of old PV and new PV messed up the filesystems. when I
> noticed the mistake, I did a shutdown and physically removed /dev/sdc.
> this also removed VG and LVs on /dev/sda5, causing the system crash on
> [root at localhost-live ~]# pvs
> PV VG Fmt Attr PSize PFree
> /dev/sda5 lvm2 --- <47.30g <47.30g
> /dev/sdc1 fedora_sh64 lvm2 a-- <298.09g 273.30g
> is there any chance to get VG and LVs back?
VG & LV are just 'terms' - there is no 'physical-content' behind them - so if
you've already used your filesystem and modified it's bits on a device - the
physical content of your storage is simply overwritten and there is no way to
recover it's content by just fixing lvm2 metadata.
lvm2 provides command: 'vgcfgrestore' - which can restore your older metadata
content (description which devices are used and where the individual LVs use
their extents - basically mapping of blocks) - typically in your
/etc/lvm/archive directory - and in the worst case - you can obtain older
metadata by scanning 1st. MiB of your physical drive - data are there in ascii
format in ring buffer so for your small set of LVs you likely should have
there full history.
When you put back your original 'drive set' - and you restore your lvm2
metadata to the point before you started to play with bad drive - then your
only hope is properly working 'fsck' - but there is nothing how lvm2 can help
More information about the linux-lvm