- Identify VM which FS you need to mount on host. virsh list –all
- If that VM is on, maybe you can scp from there? If no, better poweroff VM.
- identify your VM used LV, or just check it:
virsh domblklist vm01
- Create a temp LVM to have your host VG identified:
lvcreate -L 1M -n identifier /dev/VolGroup_HOST
. - Scan partitions on LV:
kpartx -av /dev/VolGroup_HOST/vm01
vgscan
- IF you use same names for VG in VM and host, better rename VG for now, so you would not mix it. But keep in mind, that if you have any references in configs, this might impact your system, if you use UUID, should be ok. So:
vgrename UUID VolGroup_VM01
# I use different VG names for hosts. (vgdisplay to identify which UUID is for your group, THANKS TO our identifier!). lvscan
- In my case after vgscan or lvscan my VG got activated. But If you don’t, here is how:
vgchange -ay VolGroup_VM01 ; lvscan
mkdir -p /mnt/vm01 ; mount /dev/VolGroup_VM01/root /mnt/vm01
- DO what you need
- Double check your /mnt/vm01/etc/fstab (We changed VGName, remember?!
umount /mnt/vm01
vgchange -an VolGroup_VM01
kpartx -dv /dev/VolGroup_HOST/vm01
pvscan
- Launch vm01:
virsh start vm01 ; virsh console vm01
- and remove identifier if it is bothering you.
lvremove /dev/VolGroup_HOST/identifier
, I think…
External Link
https://serverfault.com/questions/287070/how-to-mount-virtual-machines-lvm-partition-on-kvm-host