jpmorrison / OSX-Qemu

1 stars 0 forks source link

Virtio-9P - NFS #8

Open jpmorrison opened 2 years ago

jpmorrison commented 2 years ago

Export an NFS share to the guest

Qemu needs security_model=none for an NFS share. With a local share `security_model=mapped-xattr works but not with NFS/root_squash.

no_root_squash might work better but then Qemu would need to run as root (security risk), or use the qemu virtfs-proxy-helper (setuid).

If the guest OS has NFS support and good virtio networking you could also export NFS directly to the guest.

Tested with OSX/Catalina virtio-9p

NFS server

/etc/exports:

/exports/vm  172.17.0.3(rw,sync,root_squash,no_subtree_check)

Host/hypervisor

PUBLIC=/mnt
PUBLIC_TAG="NFS"
sudo mount -t nfs 172.17.0.1:/exports/vm /mnt

#Qemu args
...
-fsdev local,id=fsdev0,path=${PUBLIC},security_model=none \
-device virtio-9p-pci,fsdev=fsdev0,mount_tag=${PUBLIC_TAG} 

Guest

sudo mount_9p NFS