I have inherited a machine, let's call it Host, that uses LVM2.
On this machine, on an LVM2 logical volume, is the raw disk image for a virtual machine, let's call it Guest. Guest doesn't seem to come up and I'm trying to investigate it's hard drives.
I can see the raw disk image on /dev/sys/Guest. "fdisk /dev/sys/Guest" shows me the partition table: one ext4 partition and two LVM2 partitions. "kpartx /dev/sys/Guest" sets up /dev/mapper/sys-Guestp[123].
I can mount /dev/mapper/sys-Guestp1 and look at it. It looks like a /boot, which makes sense. So far so good.
Now... how do I mount the other two partitions? The LVM partitions?
pvscan on the two devices appears to have worked. At least, I can see them in the pv list with pvdisplay. Now.. how do I get LVM2 to recognize whatever VG's are on those PV and whatever LV are on the VG?
FWIW, it's likely that both Host and Guest were installed from the same linux distribution. So it's likely that their VG names are identical/colliding. How do I tell which PV's a particular VG uses? How do I tell which VG's are used by which LV's? I can't seem to figure out how to get the LVM on Host to "scan" and recognize the bits on this "drive". But maybe I have and I just don't recognize them because I can't tell.
Er... this must be possible, and fairly simple, I'd expect. But I'm not finding instructions. The man pages for vgscan and lvscan don't show options for scanning particular PV or LV... and running vgscan doesn't seem to add any entries to the list I see in vgdisplay...
/proc/partitions:
[root@adsp-habitat : ~]# cat /proc/partitions major minor #blocks name 8 0 4877926400 sda 8 1 204800 sda1 8 2 4877719552 sda2 253 0 4194304 dm-0 253 1 10485760 dm-1 253 2 4194304 dm-2 253 3 10485760 dm-3 253 4 10485760 dm-4 253 5 4194304 dm-5 253 6 1073741824 dm-6 253 7 157286400 dm-7 253 8 262144000 dm-8 253 9 157286400 dm-9 253 10 52428800 dm-10 253 11 52428800 dm-11 253 12 512000 dm-12 253 13 156773376 dm-13 253 14 104856696 dm-14
lsblk
[root@adsp-habitat : ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 4.6T 0 disk ââsda1 8:1 0 200M 0 part /boot ââsda2 8:2 0 4.6T 0 part ââsys-root (dm-0) 253:0 0 4G 0 lvm / ââsys-swap (dm-1) 253:1 0 10G 0 lvm [SWAP] ââsys-tmp (dm-2) 253:2 0 4G 0 lvm /tmp ââsys-usr (dm-3) 253:3 0 10G 0 lvm /usr ââsys-var (dm-4) 253:4 0 10G 0 lvm /var ââsys-home (dm-5) 253:5 0 4G 0 lvm /home ââsys-adsp--svn (dm-6) 253:6 0 1T 0 lvm
ââsys-adsp--wiki (dm-7) 253:7 0 150G 0 lvm
ââsys-adsp--cartman (dm-8) 253:8 0 250G 0 lvm
â ââsys-adsp--cartmanp1 (dm-12) 253:12 0 500M 0 dm
â ââsys-adsp--cartmanp2 (dm-13) 253:13 0 149.5G 0 dm
â ââsys-adsp--cartmanp3 (dm-14) 253:14 0 100G 0 dm
ââsys-kdump--analysis (dm-9) 253:9 0 150G 0 lvm
ââsys-rpm--builder (dm-10) 253:10 0 50G 0 lvm
ââsys-pentaho--trial (dm-11) 253:11 0 50G 0 lvm
sr0 11:0 1 1024M 0 rom
vgchange
?. Edit in the output oflsblk
, if you can. Andcat /proc/partitions