How to set up passthrough shared folder on KVM

Create the shared folder

From virt-manager Add Hardware then choose FileSystem

The source path is the path to the folder on your KVM host

Target path refers to the mount point on your KVM guest

In this case, on the guest I want to mount it to /host

mount -t 9p -o trans=virtio,version=9p2000.L,rw /dev/backup /host

If you try to create any file on /host now, you will get permission denied (even as root!)

You need to set the permission for the guest to write to folders on your host machine

On your host machine

sudo setfacl -m libvirt-qemu:rwx /files/backup/fm

`/files/backup` is not referring to my backup location, it's just a convenient way for me to note that the contents in this folder needs to be backed up.

Now you should be able to write files from your guest machine to the host

To mount the point on boot, add the following to /etc/fstab

/host   /dev/backup    9p  trans=virtio,version=9p2000.L,rw    0   0

*There are definitely security concerns with mounting your host disk on your kvm guest. I'm doing this on my homelab, as I trust what I run and it makes sense for what I am trying to accomplish.