-
-
Save neelabhg/8c6bfcdb44c0aa3f86bed00fe1f6da49 to your computer and use it in GitHub Desktop.
#! /bin/bash | |
# The Windows folder needs to be shared appropriately | |
WINDOWS_DIR_PATH="//10.0.2.2/workdir" | |
MNTPOINT="/workdir_local" | |
if [ ! -d "$MNTPOINT" ]; then | |
mkdir $MNTPOINT | |
fi | |
if [ -z "$WIN_USERNAME" ]; then | |
echo "Please set WIN_USERNAME in .bashrc" | |
exit 1 | |
fi | |
umount $MNTPOINT > /dev/null 2>&1 | |
echo "Use your Windows password to mount $WINDOWS_DIR_PATH at $MNTPOINT" | |
mount -t cifs -o user="$WIN_USERNAME",uid=501,gid=501 "$WINDOWS_DIR_PATH" "$MNTPOINT" |
I saved the steps on my blog, hope to save your time.
http://alanzheng.top/doku.php?id=tutorials:tools:qemu_windows_host_share_folder_with_linux_guest
Hi @neelabhg do we need to add some option while starting qemu OS image for this to work?
On my Windows 10 host, I have installed QEMU and Arch Linux Guest on QEMU.
After that I created and shared a folder in Windows 10 Host, which I have shared with everyone.Then started my VM by
qemu-system-x86_64.exe -m 2G -drive file=arch.hd
command.
Now I'm trying to mount that shared folder from Arch Linux using following command.
mount -t cifs -o user=windows_username,domain=windows_domain_name //10.0.2.2/Share_directory /home/user/local_mount
I'm getting error
mount error(2): No such file or directory.
I tried by givingvers
option as well, still no luck.
Hi @ketanarlulkar,
I had written this script quite some time ago. I believe I was using Windows 7. I don't remember if there were any special options passed to QEMU when starting it.
I saved the steps on my blog, hope to save your time.
http://alanzheng.top/doku.php?id=tutorials:tools:qemu_windows_host_share_folder_with_linux_guest
Sure, that's fine!
Here is my solution to mount a Windows host shared folder on Ubuntu guest
On Windows host, a shared folder need to be setup, right click a folder, Properties -> Sharing, e.g shared_windows_folder
On Ubuntu guest, do the following
sudo apt install cifs-utils
sudo mount.cifs -o user=$WINDOWS_USER,uid=1000,gid=1000 //10.0.2.2/shared_windows_folder /mnt
You will see shared_windows_folder
content on /mnt
.
Hi @neelabhg do we need to add some option while starting qemu OS image for this to work?
On my Windows 10 host, I have installed QEMU and Arch Linux Guest on QEMU.
After that I created and shared a folder in Windows 10 Host, which I have shared with everyone.
Then started my VM by
qemu-system-x86_64.exe -m 2G -drive file=arch.hd
command.Now I'm trying to mount that shared folder from Arch Linux using following command.
mount -t cifs -o user=windows_username,domain=windows_domain_name //10.0.2.2/Share_directory /home/user/local_mount
I'm getting error
mount error(2): No such file or directory.
I tried by giving
vers
option as well, still no luck.