Before mounting the guest VM, we first need to check if there are other LVM devices currently mounted on the host, to avoid any confusion. However, if there already is a LVM device with the same name as the one of the guest VM, we will not be able to extract the guest's filesystem because it will not be correctly mounted on the host. I added some useful output in case such thing happens.
If, instead, there is another LVM device but with a different name, the assumption is that lvdisplay will show the devices in order, so the one belonging to the guest VM will be the last one.
LVM filesystems are a bit tricky to handle.
Before mounting the guest VM, we first need to check if there are other LVM devices currently mounted on the host, to avoid any confusion. However, if there already is a LVM device with the same name as the one of the guest VM, we will not be able to extract the guest's filesystem because it will not be correctly mounted on the host. I added some useful output in case such thing happens.
If, instead, there is another LVM device but with a different name, the assumption is that
lvdisplay
will show the devices in order, so the one belonging to the guest VM will be the last one.