Discussion:
LVM in LVM
(too old to reply)
Steve Keller
2024-09-16 09:40:01 UTC
Permalink
In older Debian releases, I think at least until Debian 9, it was
possible to access PVs and LVs which are stored in a LV. The PV
inside the containing LV could be displayed and activated with
vgdisplay(8) and vgchange(8).

This scenario makes sense if you have a LV for a VM guest, that uses
LVM inside, and when you need to access file systems in the guest from
the host (while the guest is shutdown).

I don't see how this can be done in the current Debian 12.

Steve
Tim Woodall
2024-09-16 10:50:01 UTC
Permalink
Post by Steve Keller
In older Debian releases, I think at least until Debian 9, it was
possible to access PVs and LVs which are stored in a LV. The PV
inside the containing LV could be displayed and activated with
vgdisplay(8) and vgchange(8).
This scenario makes sense if you have a LV for a VM guest, that uses
LVM inside, and when you need to access file systems in the guest from
the host (while the guest is shutdown).
I don't see how this can be done in the current Debian 12.
Steve
Not sure because I've previously battled the opposite problem but I'd
start here in lvm.conf

# Configuration option devices/sysfs_scan.
# Restrict device scanning to block devices appearing in sysfs.
# This is a quick way of filtering out block devices that are
# not
# present on the system. sysfs must be part of the kernel and
# mounted.)
sysfs_scan = 1

# Configuration option devices/scan_lvs.
# Scan LVM LVs for layered PVs, allowing LVs to be used as PVs.
# When 1, LVM will detect PVs layered on LVs, and caution must
# be
# taken to avoid a host accessing a layered VG that may not
# belong
# to it, e.g. from a guest image. This generally requires
# excluding
# the LVs with device filters. Also, when this setting is
# enabled,
# every LVM command will scan every active LV on the system
# (unless
# filtered), which can cause performance problems on systems
# with
# many active LVs. When this setting is 0, LVM will not detect
# or
# use PVs that exist on LVs, and will not allow a PV to be
# created on
# an LV. The LVs are ignored using a built in device filter that
# identifies and excludes LVs.
scan_lvs = 0
Steve Keller
2024-09-20 09:30:02 UTC
Permalink
Post by Tim Woodall
Post by Steve Keller
I don't see how this can be done in the current Debian 12.
Not sure because I've previously battled the opposite problem but I'd
start here in lvm.conf
# Configuration option devices/scan_lvs.
# Scan LVM LVs for layered PVs, allowing LVs to be used as PVs.
# When 1, LVM will detect PVs layered on LVs, and caution must
# be
# taken to avoid a host accessing a layered VG that may not
# belong
# to it, e.g. from a guest image. This generally requires
# excluding
# the LVs with device filters. Also, when this setting is
# enabled,
# every LVM command will scan every active LV on the system
# (unless
# filtered), which can cause performance problems on systems
# with
# many active LVs. When this setting is 0, LVM will not detect
# or
# use PVs that exist on LVs, and will not allow a PV to be
# created on
# an LV. The LVs are ignored using a built in device filter that
# identifies and excludes LVs.
scan_lvs = 0
Thanks, that's exactly what I was looking for. I've set scan_lvs = 1
and called vgscan, and now I see the embedded PV and can activate it.
In older Debian releases this was default and changed sometime after
Debian 9.

Steve

Andy Smith
2024-09-16 16:50:02 UTC
Permalink
Hi,
Post by Steve Keller
In older Debian releases, I think at least until Debian 9, it was
possible to access PVs and LVs which are stored in a LV.
[…]
Post by Steve Keller
I don't see how this can be done in the current Debian 12.
Works fine for me on all versions of Debian up to stable. Haven't
tried it on newer. I use it in exactly the scenario you describe.

Check your filters in /etc/lvm/lvm.conf as otherwise the system
won't scan block devices that are LVs, so won't find PVs on them.

Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
Loading...