From 36f46edf0b288229c4aa7f78421b10a4b8ea1b1e Mon Sep 17 00:00:00 2001 From: Stephen Bates Date: Thu, 21 Nov 2024 15:56:57 -0700 Subject: [PATCH] run-vm: Add the ability to share folders on the host. --- qemu/run-vm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qemu/run-vm b/qemu/run-vm index 3b5c85f..7634fde 100755 --- a/qemu/run-vm +++ b/qemu/run-vm @@ -4,6 +4,14 @@ # # (C) Stephen Bates # +# A simple script to run a VM that was (probably) generated using the +# gen-vm script. Note that to pass in a host filesystem you need to +# run something like: +# +# sudo mount -t 9p -o trans=virtio hostfs /home/batesste/Projects -oversion=9p2000.L +# +# In the guest. For some reason -t virtfs does not work when running +# qemu directly but it does work when running via libvirt. Go figure! VM_NAME=${VM_NAME:-qemu-minimal} ARCH=${ARCH:-amd64} @@ -23,10 +31,9 @@ fi if [ ${FILESYSTEM} == "none" ]; then FILESYSTEM_ARGS="" else - FILESYSTEM_ARGS="-virtfs local,id=hostfs,path=${FILESYSTEM},security_model=mapped,mount_tag=hostfs" + FILESYSTEM_ARGS="-object memory-backend-memfd,id=mem,size=2G -virtfs local,path=${FILESYSTEM},security_model=passthrough,mount_tag=hostfs " fi - if [ ${ARCH} == "amd64" ]; then QARCH="x86_64" QARCH_ARGS="-machine q35${KVM}"