You are not logged in.

#1 2015-07-01 14:26:18

gizzard
Member
Registered: 2010-08-21
Posts: 25

Can't access LVM logical volume with qemu-KVM

I start QEMU-KVM from the command line (ie no virt-manager) with the following command as a regular user (non-root):

qemu-system-x86_64 --enable-kvm \
-M q35 \
-m 6144 -cpu host,kvm=off -smp 2,sockets=1,cores=2,threads=4 \
-vga std -full-screen \
-net nic,model=virtio -net bridge,br=br0 \
-usbdevice tablet \
-rtc base=localtime \
-boot menu=on \
-drive file=win81_new.qcow2,media=disk,cache=none,if=virtio,aio=native

A Windows 8.1 VM starts perfectly well.  I'd like to add a LVM logical volume to the VM so that it appears as an unformatted empty disk to Windows.  I tried adding these lines (one at a time):

-drive file=/dev/mapper/vg1-vmdata,media=disk,cache=none,if=virtio,aio=native \
-drive file=/dev/vg1/vmdata,media=disk,cache=none,if=virtio,aio=native \

Each time I receive an error that qemu cannot open the LV due to Permission denied.

Questions:
1. Is "-drive file=*" the correct option to pass a block device (LV), rather than a disk image (qcow2, etc)?
2. Can I pass the LV directly from /dev/mapper/vg1-vmdata to qemu-KVM or do I first have to mount it to another directory?  I currently mount other LVs from this VG via fstab that are readable by this user on the host.
3. If I am not mounting the LV on the host, how do I address the permissions?
4. I did not create a file system on this LV - is that correct?

My google-fu has found many examples if this being done using virt-manager but none when using qemu-system-x86_64 directly.  I will eventually migrate everything to virt-manager, just haven't had time yet.  Thanks for any thoughts / suggestions!

Offline

Board footer

Powered by FluxBB