Share Files Between Host and Linux Virtual Machine over Hyper-V
Last updated on June 16, 2023 pm
Share Files Between Host and Linux Virtual Machine over Hyper-V
Generally speaking, just follow this post and things will be all set.
Shared Folders over Hyper-V Ubuntu Guest
Also, attach a USB drive to the VM is a feasible way, but on Windows 10, it is not support to make a removable device offline, so it is not applicable for SD / TF card. Unreasonable…
Some Notices
1.
On Advanced sharing settings on host Windows machine, make sure all entries under All Networks item are selected as turned on. Otherwise, there might be a permission deny on mounting.
2.
For accessing host directory as root user, no -o
flag needed when running mount.cifs
command. Also, password for host root can be put as pressing Enter
.
3.
Read and write to the shared directory will need root permission at this case.
4.
Simply running umount
(unmount) the directory like unmount other device can disable the sharing.
Next Time
Every time start the linux vm, simply run mount.cifs
again can enable the directory sharing.
Or it can be automated by a bash script as follow:
1 |
|
If the CIFS is not mounted, the path is mounted from device tree /dev
by default. But after mounting, it will be changed to the host shared folder name, this can be verified by df -h
.