This post introduced how to share linux folder to Windows guest VM
How
-
Install
samba(QEMU bring it up automatically actually according to ArchWiki) -
Add
xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'to root<domain>node -
Add child XML node
<qemu:commandline> <qemu:arg value='-net'/> <qemu:arg value='user,smb=/path/to/shared/directory'/> </qemu:commandline> -
Poweroff VM (DON’T restart)
-
Poweron it
-
ps -ef | grep qemushould show the-net user,smb=....argument now -
Open samba share from windows
-
Ref: https://unix.stackexchange.com/questions/188301/how-to-set-up-samba-sharing-with-libvirtd
Troubleshooting
smbd not start (Fixed in QEMU 2.x): Debian Bug tracker - samba4 does not work with qemu
ACL issue: https://ask.fedoraproject.org/t/unable-to-share-folder-with-virt-manager-qemu/2580/17
QEMU smb option: https://qemu.weilnetz.de/doc/qemu-doc.html#Network-options
Note
I didn’t succeed to make smbd auto-start with qemu process till the end, so I use regular /etc/samba/smb.conf to start a standalone samba server which managed by systemd to make this work.