- How to set up shared folders in virt-manager
- ← BUY THE PRE-RELEASE
- Sharing a folder a windows guest under virt-manager
- Share this:
- 14 thoughts on “Sharing a folder a windows guest under virt-manager”
- Leave a Reply Cancel reply
- Thread: KVM Share Folder Between Win 10 Guest & Host.
- KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Re: KVM Share Folder Between Win 10 Guest & Host.
- Use virt-manager to share files between Linux host and Windows guest?
- 8 Answers 8
- Filesystem Passthrough
- Setting up Samba
How to set up shared folders in virt-manager
Do you need to set up a shared folder between your host OS and guests running in virt-manager? I will show you how to do it on your Fedora system which involves a SELinux policy change.
First of all, if you don’t have it already, install virt-manager and create a virtualized guest which should be pretty straightforward. Afterwards create a future share folder on your host and set up the permissions (for the purpose of this article I will grand all permissions):
Afterwards shut down the guest if it’s running and attach the new filesystem in virt-manager:
- Switch the view to detail hardware view: View > Details
- Go to Attach hardware > Filesystem
- Fill in the name of the source path (/share in our case) and virtual target path (anything you like, I will go with /sharepoint)
- Switch mode to Mapped if you need to have write access from the guest
- Confirm and start the VM again
Now you can mount your shared folder from the VM:
Or permanently add it to /etc/fstab file:
If you don’t have SELinux enabled everything should work now. If you do (which I recommend), you will need to add a policy for files under your /share folder on your host. SELinux won’t allow you to share this folder until it’s labeled svirt_image_t. Here is how to add this policy on your host using semanage:
That should be it. If not, check the logs :).
← BUY THE PRE-RELEASE
I am writing a complete guide on web application deployment. Ruby with Puma, Python with Gunicorn, NGINX, PostgreSQL, Redis, networking, processes, systemd, backups, and all your usual suspects. 19 chapters and 2 case studies already available.
Sharing a folder a windows guest under virt-manager
Sharing data between guest and host system is necessary in many scenarios. If the guest is a Linux system, you can simply add a shared folder that will be automatically mounted. However, this does not work if the guest is Windows. Sometimes, you can simply workaround it by using Samba shares, but in some scenarios network configuration makes it difficult. For example, when using usermode networking, the host machine can’t communicate easily via the network with the guest.
However, there is another way to share folders in virt-manager that actually works for Windows guest – SPICE . The first step is to configure the sharing in virt-manager . In the VM details view, click on “Add Hardware” and select a “Channel” device. Set the new device name to org.spice-space.webdav.0 and leave the other fields as-is.
Now start the guest machine and install spice-webdav on the guest machine. After installing spice-webdav make sure the “Spice webdav proxy” service is actually running (via services.msc ).
Now running C:\Program File\SPICE webdavd\map-drive.bat will map the shared folder, which is by default
/Public . If you encounter the following error
It means that the Spice webdav proxy service is not running.
If you want to change the shared folder, you will have to use virt-viewer instead of virt-manager , and configure it under File->Preferences.
Share this:
14 thoughts on “Sharing a folder a windows guest under virt-manager”
I got this running with a linux virt-manager and windows guest.
Seemed to be working, though extremely laggy while browsing directories.
However, when I try to copy or access large files, say only 400-500 MB and larger, the windows guest errors out with a message to indicate the file size limit is exceeded.
Really? Have you ran into this before?
Thank you.
I didn’t stress test it, so I didn’t run into large files problems. When I need to copy very large files back and forth, I usually just mount the disk image and work directly on it.
I really like this concept, but it’s not ready for prime time….at least from my experience. It was far too laggy to be useful. For some of my windows-based applications, in order to access files over the share, I had to keep a windows explorer window open and continually refresh the shared folders. This would allow the application to access the files from a hang state. It would work for a few seconds, then I’d need to refresh again. Apparently, whatever file library the application used was not compatible with this share.
I’ve abandoned this concept and run a local samba share. Orders of magnitude better performance (once I got the samba tricks figured out).
Didn’t work for me, seemed like the server process was crashing.
A bit more googling got me to https://blogs.msdn.microsoft.com/commandline/2019/02/15/whats-new-for-wsl-in-windows-10-version-1903/ , which talks about sharing files between WSL linux and windows. Not terribly interesting for us… except that it says the sharing is done over 9p and mentions a 9p client.
Once this update is out, I’m wondering if that 9p client (or server) would work for filesharing between linux hosts and windows guests.
In the meantime, though, WSL got me thinking – how would I transfer files from one linux host to another? scp, of course! So I generated a key, added the pub component to my host’s authorized_keys, and now I can scp files around. The lack of gui could be an issue for some, but I’m quite happy with the command line myself.
What should I set the target in the target path, and the driver type and mode type in virt-manager to? (see here: https://i.imgur.com/cksNRqv.png)
I am trying to find a way to share files between a linux host and a window7 VM that does require exposing the VM to my network. We are trying to keep it isolated from the greater network on purpose. This eliminates the samba method of sharing as far as I can tell. Any suggestions?
This method would work without network, but it’s buggy/laggy. I switched to samba instead. But if you must remain off the network, then give this method a try.
Cant get it to working, “Spice webdav proxy service” wont start, with error: 1067
Windows could not start the Spice webdav proxy service on local computer
Unfortunately, when installing ‘Spice webdav’ an error occurs.
As an alternative, I found a way to share a ‘host’ machine folder by logging in as a user with a password from the XP guest (guest ok = no). The registry must be modified as follows:
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Lsa] “LmCompatibilityLevel” = dword: 00000001
Also. deselect ‘USE SIMPLE SHARED USE OF FILES’ in ‘folder options’ tab ‘see’
and put the machine in ‘WORKGROUP’
Sorry, English is not my native language!
Source:
‘https://bgstack15.wordpress.com/2017/10/01/samba-and-ntlm-for-windows-clients/’
This post was promising but I too got the 1067 errors and could not get the service to start. The missing part of the puzzle for me was that the latest guest tools have to be installed on the windows guest also (https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe). The guest tools installed a lot of what I believe are the virtio drivers, so I think I got much more than necessary. But once installed the proxy service started. Then I was able to configure virt-viewer for share, and the map-drive.bat script mapped the shared folder to z:
No such menu item as “Menu -> Preferences” under either the manager window or the VM config window. And under Edit -> Preferences, there’s nothing for editing the path to the shared directory. (and the version that comes with Linux Mint 19.x doesn’t have an XML edit window).
First I got error 1067 too – turns out that I installed x86 spice-webdav instead x64. After changing it to valid version service starts properly.
Then when I tried to run .bat, i encountered error 67 (with webdav proxy running!). Found out on github.com/lofyer/spice-webdav that firewall should be disabled. Can confirm, it fully works now.
jrv Said the missing part of the puzzle for him was figuring out that the guest tools had to be installed on the client. It’s the opposite problem for me. Apparently there are tools that need to be installed on the host. Could someone tell me what those tools are (for Ubuntu 20.04 x64) ? BTW, the map-drive.bat file worked perfectly for me in my Win7 guest and the Spice webdav proxy service is running in services.msc.
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Thread: KVM Share Folder Between Win 10 Guest & Host.
Thread Tools
Display
KVM Share Folder Between Win 10 Guest & Host.
Something to do with Samba right? Have guest IP.
Lost. Much. What arcane wizardry is this? Pointers please.
Silicon Heaven [RIP]
X250 Lenovo Thinkpad i7
Linux Mint 20.1
C2D Extreme QX9650 Micro ATX Tower (2nd Main Board)
openSUSE Tumbleweed KDE
Re: KVM Share Folder Between Win 10 Guest & Host.
Something to do with Samba right? Have guest IP.
Lost. Much. What arcane wizardry is this? Pointers please.
Hi
In virtual manager, add ‘virtual hardware’ then filesystems, add the directory you want to share.
Re: KVM Share Folder Between Win 10 Guest & Host.
Yes indeedy. Went down Samba blind alley, can’t see the wood for the trees! Must think before opening my big mouth to bother you with my question insteada researching the **** outa it proper. Google, as ever, is our friend. Something my IT literate cousins would quote. But thanks for putting me on correct path. Loving it.
Silicon Heaven [RIP]
X250 Lenovo Thinkpad i7
Linux Mint 20.1
C2D Extreme QX9650 Micro ATX Tower (2nd Main Board)
openSUSE Tumbleweed KDE
Re: KVM Share Folder Between Win 10 Guest & Host.
Does it work for Windows? Last time the question came up I was not able to find 9p driver for Windows and quick search now does not show one either. Unless this creates SMB share under the hood.
Re: KVM Share Folder Between Win 10 Guest & Host.
Now networking in VMs is screwed. Snapper rollback only works for root right?
Silicon Heaven [RIP]
X250 Lenovo Thinkpad i7
Linux Mint 20.1
C2D Extreme QX9650 Micro ATX Tower (2nd Main Board)
openSUSE Tumbleweed KDE
Re: KVM Share Folder Between Win 10 Guest & Host.
Inplace upgrade of Virt Manager package fixes networking, will be more careful next time. Women & computers do not mix as both require your full attention! It is impossible to concentrate on two things at once.
Silicon Heaven [RIP]
X250 Lenovo Thinkpad i7
Linux Mint 20.1
C2D Extreme QX9650 Micro ATX Tower (2nd Main Board)
openSUSE Tumbleweed KDE
Re: KVM Share Folder Between Win 10 Guest & Host.
FYI
Oftentimes you will want a way to share files between HostOS and Guest that doesn’t require a working networking connection.
Or, You don’t want to go through all the trouble of setting up a SAMBA server.
Re: KVM Share Folder Between Win 10 Guest & Host.
DOH. Ran this command in host not guest;
Well,
When you specify the Plan9 protocol (9p) you’re not actually going through the normal networking stack. The Plan9 protocol is somewhat special in that it is generally implemented as a side channel. For more information about this, one quick source
http://blog.allenx.org/2015/07/03/virtio-9p-note
So, it shouldn’t affect regular TCP/IP networking. If you’re experiencing networking problems with other Guests or machines, then it’s something else.
In any case, if you’re still experiencing problems, I recommend you re-make your HostOS shared directory configuration according to the link I posted in the previous post.
Use virt-manager to share files between Linux host and Windows guest?
Is it possible to use «Filesystem Passthrough» virtual hardware option inside virt-manager to share a folder on my Linux host with my Windows guest? I found some tutorials for how to do this with a Linux guest, but when I try this with my Windows guest I receive the following error message when attempting to start the VM:
I tried sourcing some documentation but all I could find was the official page linking to a FAQ and «some screenshots».
8 Answers 8
I don’t believe this is possible using Windows guests. I usually setup a Samba server on the Linux KVM host and then share a folder out using that to my KVM guests.
Filesystem Passthrough
The documentation on sharing a KVM host’s directory with the KVM guests (Linux) is available here on the virt-manager website. The page is titled: Example Sharing Host files with the Guest.
Setting up Samba
The linux-kvm website also contains directions for setting up Samba. That documentation is available here, titled: Tip: How you can share files on your Linux Host with a Windows Guest using Samba.
Default file managers of both Gnome and KDE desktop environtment can easily access windows shared resources using SMB protocol.
You don’t need to install a samba server on Linux host machine because Windows O.S. already comes with built-in samba communication protocols.
Let’s say your guest O.S. is «Windows XP» for instance, choose the folder you want to share or just create one for that purpose, e.g. «hostshare» and right click on it -> «properties» -> «sharing» Tab -> select: «Share this folder on the network» and «Allow network user to change my files«.
At this point be sure that windows’ firewall gives access to shared file and printer resources. Go to «start Menu» -> «settings» -> «Control Panel» -> «windows firewall» -> «Exceptions» Tab -> select: -> «File and Printer Sharing«.
Make sure that the Linux host machine can be seen from Windows guest V.M. through the network. So, from windows’ command line type: «ping 10.0.0.12» where in this case (as an example) «10.0.0.12» is the host IP address; you have to change it to your own. If you do not have echo’s responses you’ll have to get into troubleshooting that.
And do the same thing from Linux command line: «ping -c3 192.168.122.216«, where these numbers (as an example) belong to the virt-IP address assigned to the guest V.M.; you must change it to your own.
To get Windows IP address run this command: ipconfic