virt-manager
share local/host dir with vm
In the virtual machine settings:
Add hardware -> Fileystem
Driver: virtio-9p
Source path: /home/user/vmshare
Target path: hostshare
Save changes, power off vm and start vm again. (restart is not enough to active VM changes)
Now in the VM do the following;
mkdir ~/hostshare
sudo mount -t 9p -o trans=virtio,version=9p2000.L hostshare ~/hostshare
Qemu
Starting a virtual machine with Qemu using kvm sudo qemu-system-x86_64 -enable-kvm -m 4096M -smp 2 -boot order=d -drive file=/mnt/disk_images/some_image.cow,if=virtio -vga qxl -spice port=5930,disable-ticketing -net nic -net bridge,br=bridget -usb -fsdev local,id=test_dev,path=/mnt/usb,security_model=passthrough -device virtio-9p-pci,fsdev=test_dev,mount_tag=externusb
When using above command. You also create a fileystem device for the virtual. This can be very usefull when you want to share files between the host and the virtual. Within the virtual you can use the following command to mount this filesystem. sudo mount -t 9p -o trans=virtio externusb /mnt/usb -oversion=9p2000.L,posixacl,cache=loose
Spice
The Qemu command above also uses spice. A beautifull and simple way to get remote access to your vm. https://www.spice-space.org/
To connect to your vm you can use spicy. Installed on arch with pacman -S spice-gtk