Hi , Since you mentioned you don’t necessarily need 9p, you can try an alternative like Virtio-FS, which is often faster and better integrated for sharing directories between the host and guest in modern virtualized environments.
Steps to use Virtio-FS:
- Check host support: Make sure that your host supports Virtio-FS. You should have the
virtiofsd
package installed on your host. On Rocky Linux, you can install it with:
sudo dnf install virtiofsd
- QEMU command: When launching QEMU, use the parameter for Virtio-FS. For example:
-virtfs local,path=/path/to/host/directory,mount_tag=shared,security_model=none,id=fs0
-device vhost-user-fs-pci,chardev=char0,tag=shared
-chardev socket,id=char0,path=/var/run/vhost-user-fs.sock
Be sure to replace /path/to/host/directory
with the actual path on your host.
- Modify cloud-init or fstab on the guest: Update the mount configuration. If you are using
cloud-init
, the new mount point might look like this:
["shared", "/mnt/shared", "virtiofs", "defaults", "0", "0"]
Alternatively, you can manually add the entry in /etc/fstab
on the guest:
shared /mnt/shared virtiofs defaults 0 0
- Start the VM: Start the guest VM with the new configuration and check if you can successfully mount the shared directory using Virtio-FS.
This setup should provide a more stable and higher-performance solution than 9p for sharing directories between host and guest in modern virtual machines.