QEMU Windows Guest: Easy File Sharing with QEMU's built-in SMB (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Fri, 06 Oct 2023

QEMU Windows Guest: Easy File Sharing with QEMU's built-in SMB

Last year I wrote about my efforts to share files in QEMU between a Linux host and Windows guest. Someone in the comments pointed me to WinFSP and WinSSHFS, and I was able to get file sharing working that way, after installing both those packages on the Windows guest.

But I recently found a much easier way, using QEMU's built-in SMB handler. Though calling it that isn't quite right: you have to have samba installed on the Linux host, and then QEMU has a built-in way of setting up an SMB share without needing any samba wizardry from you. Apparently QEMU has had this SMB setup built in for many years, but for a while it didn't work well, so a lot of what I found about it on the web was people struggling.

Add this to your qemu command line:

    -nic user,id=nic0,smb=/path/to/share/directory

(If you're running under virt-manager, there may be a way to find it in the menus, but if not, you may have to edit the qemu command-line that virt-manager runs.)

Once you're running under QEMU with built-in SMB, on the Windows guest, in Windows Explorer, click on "Map network drive" then type in:

\\10.0.2.4\qemu

You should see your share directory in Windows Explorer. That's all! So easy!

Update: The SMB disk only lasts for the current session: Windows won't remember your SMB disk the next time you boot. But you can save a permanent link by clicking "Pin to Quick access" on the top left of the Explorer window.

Tags: , , ,
[ 08:02 Oct 06, 2023    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus