Shared folder in QEMU Virtual Machine (Windows)

In this article, we would focus on how to get a shared folder in QEMU Virtual Machine (Windows 10). We would first install Samba on our host Operating System (i.e. Ubuntu). Thereafter, we will configure network on our guest Operating System (i.e. Windows 10). Samba is released under GNU General Public License​. It was first released in the year 1992.

Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Install Samba on Ubuntu host Operating System

Since, the package samba in already available in standard Ubuntu repository. Therefore, we would first update the repository –

sudo apt update

This makes the latest version of package available. Now, to install samba package –

sudo apt install samba

Configure Network on Windows 10 guest Operating System

We have to provide following options to utilize QEMU’s built-in SMB server –

-net nic -net user,smb=shared_folder_path

So, if you are running a Virtual Machine through command-line then –

qemu-system-x86_64 -net nic -net user,smb=<shared_folder_path> -smp <number of cores> -cpu host -enable-kvm -m <memory_size> -drive format=qcow2,file=/path/to/disk_image.qcow2

For instance,

qemu-system-x86_64 -net nic -net user,smb=/dev/shm/ -smp 2 -cpu host -enable-kvm -m 2048 -drive format=qcow2,file=/path/to/disk_image.qcow2

for i386 architecture, we can replace qemu-system-x86_64 with qemu-system-i386.

Now, inside our Windows guest Virtual Machine, we need to open File explorer and then right-click on This PC. And, click Add a Network Location option.

It would get us a Add Location Wizard. Click Next.

If in case we get a Connect to Internet prompt, then we can close it from the taskbar itself. Otherwise, it will close our Add Location Wizard too.

Then, select – Choose a Custom Network Location and click Next.

In Internet or Network Address, enter the following –

\\10.0.2.4\qemu\

Thereafter, either we can provide a name for the network location or continue with default values. Click Next and Finish.

Afterwards, to access the shared folder – open File Explorer and click This PC. Under Network Location section, the shared folder is available.

In conclusion, we have discussed how to get a shared folder access in QEMU Virtual Machine (Windows 10 guest Operating System).

Similar Posts