I got "shared folders" working for the first time. I mean actual virtio shared between host and guest (I used to just use networking... the network stack will use loopback by default if it's on the same host). I liked the simplicity of my simple qemu client, but now that I have virt-manager and the whole stack of qemu shit installed, I might as well.
Unfortunately it needs something in the host kernel that I don't like, page merging (KSM, kernel samepage merging support) that I have never wanted to enable. It merges pages with the same data into one, it's a memory saving feature. It's more designed for KVM, so you can save memory while running multiple VM's but can be enabled on the fly with madvise system calls by applications. (It can also be enabled with a sysfs tunable... echo 1 > /sys/kernel/mm/ksm/run which defaults to 0). The thing is this induces overhead (a bit of cpu time), but I don't think anything but qemu/KVM is going to ask for that and if it does cause problems, it can be disabled with that same sysfs knob)
This is because KVM guests need "shared memory" to use virtiofs shares, and it's KSM that allows this on the host.
Again, silly GUIs can be such a disconnect. After taking care of the host, I need to enable it in virt-manager for the guest. I enabled shared memory under Memory but I'm looking all over the place for a setting to enable the sharing, but it's nowhere. I do a web search and find old info, but yes indeed I should be seeing it in "Options" and I just have to find it in the newer UI. It finally dawns on me that I have to go to Add Hardware, that's how they've implemented everything now in that device tree (viewing "Details" of the virtual machine). So it's Add Hardware, and "Filesystem virtiofs". There you choose the path to the mount point on the host, but also a target directory (actually target_path in the XML config files). No, this is not the mount point in the guest, just a virtiofsd identifier, arbitrary. I named mine virtmount. I'm wondering "what fucking target, why would this know about the mount point in the guest" but it's just a mount tag for the guest to access it on the host, like share name, not a path. How "intuitive"
Anyway, with all the ducks in a row, in a Linux guest it's done using the mount command (or some browsable GUI equivalent?)
Code: Select all
mount -t virtiofs virtmount /mnt/virtmount
That's "mount -t virtiofs target_path mount_point_on_guest"
For Windows guests, it has nothing to do with this. I'd have to use smbd on the host or some sftp client or something. (can do... I have the in-kernel ksmbd module and I'd just have to install some tools on the host and drop in my conf from my LFS. It's a bit different than a normal samba smbd.conf and uses its own password hashes in a file. I hate Samba and prefer to work with that)