View previous topic :: View next topic |
Author |
Message |
sdauth l33t
Joined: 19 Sep 2018 Posts: 645 Location: Ásgarðr
|
Posted: Sun Dec 17, 2023 7:41 pm Post subject: [SOLVED] qemu - shared folder without networking ? |
|
|
Hi,
I have a win10 vm and would like to share a folder (/mnt/data/winshare) without having to enable any networking on the vm.
My vm is started with '-nic none' option, so basically I would like to replicate what virtualbox can easily do but with qemu. What are my options ?
Thanks!
Last edited by sdauth on Tue Dec 19, 2023 10:46 pm; edited 1 time in total |
|
Back to top |
|
|
blu3bird Retired Dev
Joined: 04 Oct 2003 Posts: 614 Location: Munich, Germany
|
Posted: Sun Dec 17, 2023 8:03 pm Post subject: |
|
|
virtiofs works okayish though permission can be a pain in the butt.
Personally, I'd go for a host-only network and just use samba. _________________ Black Holes are created when God divides by zero! |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3420
|
Posted: Mon Dec 18, 2023 6:22 pm Post subject: |
|
|
There is 9P in kernel.
Qemu is said to be capable of exposing a host's directory to the guest as a 9p device. I've never used it though, for one-time stuff I'd just use a file as a block device because I already know how to use it. |
|
Back to top |
|
|
sdauth l33t
Joined: 19 Sep 2018 Posts: 645 Location: Ásgarðr
|
Posted: Tue Dec 19, 2023 12:22 am Post subject: |
|
|
Hi,
So I tried virtfiofsd, not straightforward to setup, arch wiki was helpful.
On my qemu command line, I added the following :
Code: | -object memory-backend-memfd,id=mem,size=16G,share=on \
-numa node,memdev=mem \
-chardev socket,id=char0,path=/mnt/vm/win10/win10-virtfs.sock \
-device vhost-user-fs-pci,chardev=char0,tag=winshare \ |
Before starting the vm, you need to start virtiofsd with the vm socket and dir to share :
Code: | /usr/libexec/virtiofsd --socket-path=/mnt/vm/win10/win10-virtfs.sock --shared-dir /mnt/data/winshare --cache always |
Some warning, error, I don't know yet how to solve this. (I start virtiofsd as user)
Code: | 2023-12-18T23:46:53Z WARN virtiofsd::limits Failure when trying to set the limit to 1000000, the hard limit (4096) of open file descriptors is used instead.
2023-12-18T23:46:53Z WARN virtiofsd::sandbox Couldn't set the process uid as root: -1
2023-12-18T23:46:53Z WARN virtiofsd::sandbox Couldn't set the process gid as root: -1
2023-12-18T23:46:53Z INFO virtiofsd Waiting for vhost-user socket connection...
2023-12-18T23:46:54Z INFO virtiofsd Client connected, servicing requests
Warning: Cannot announce submounts, client does not support it
2023-12-18T23:57:51Z ERROR virtiofsd::passthrough::credentials failed to change uid back to root: Invalid argument (os error 22)
2023-12-18T23:57:51Z ERROR virtiofsd::passthrough::credentials failed to change gid back to root: Invalid argument (os error 22)
2023-12-19T00:03:12Z INFO virtiofsd Client disconnected, shutting down |
Nonetheless, the share works fine. I copied, deleted files without issue.
On the windows side, you need to install latest WinFsp & virtio-win (See: https://virtio-fs.gitlab.io/howto-windows.html )
After reboot, go in "Services" and make sure that virtiofs service is set to start automatically.
Also, I tried with a win7 vm but unfortunately it doesn't work.
Thanks for the suggestion blu3bird!
@szatox, isn't 9p only Linux though ? I'll give a try to file as block device later, this could be even better than virtiofsd for my use case... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|