Hyper-V: Access to USB-stick and shared directory

I managed to install Manjaro under Hyper-V on an MS WIN 11 Pro OS :slight_smile:

Two things seem to be important:

  • disable “secure boot” in the settings of your Manjaro-VM
  • Choose Generation 2 of virtual machine type

In the WIKI of archlinux you find a didicated article about the topic Hyper-V,
which is quite helpful in some details.

But I face two problems:

  • Create a shared folder to a host-machine folder
    
  • Access a removable USB storage
    

Especially the mounting of a host-machine folder from within the VM via cifs-utils would be nice.
My questions start with the appropriate mounting point, should it be:
/run/media/your_user_name/hyper-v
and how could it be achieved to automatically create this folder or rather:
/mnt/hyper-v?

In the first attempt I tried the static approach under /mnt/hyper-v.
Unfortunately, I fail to resolve the issue:
“mount.cifs: permission denied: no match for /mnt/hyper-v found in /etc/fstab”

First Question:
Any idea what I should add inside /etc/fstab**?**

Second Question:
Any idea how how to anable automounting of USB-sticks inside the virtual machine?

I have zero experience with Hyper-V because I do not use or have any version of Windows.

This should be addressed with section 6 and 6.1 of the Arch Wiki:

Hyper-V - ArchWiki

In order to use Hyper-V integration services, install hyperv and start/enable the services hv_fcopy_daemon.service, hv_kvp_daemon.service and hv_vss_daemon.service.
… et cetera pp …

You can choose the mount point freely - /mnt or a subdirectory of it (create it first) would be a “natural” choice, IMO.

/run is not a good choice, especially when you want to use /etc/fstab
/run is a temporary directory - it’s content gets created dynamically on every boot
Whatever directory you create as a mount point in this directory will be lost on the next boot.

Because I have never seen the GUI of Hyper-V, I can’t say anything about how to pass a USB device through.
I know it’s quite easy with VirtualBox or virt-manager.
No idea about the same thing in Hyper-V.

You could just “mount” it on the host and then treat it as a shared directory
instead of passing it through without the host seeing it?
But I don’t know enough about Windows …

Generally speaking the Arch Linux Wiki is a great resource - and it applies almost 1-1 for Manjaro Linux → Hyper-V - ArchWiki

Nothing.

If you use the default network settings you are likely using NAT - which will make your hosts network inaccessible from the guest.

To be able to access the host’s network - including any shared folders on your host - you will need to configure the virtual network using bridged network.

As for mounting samba shares see

[root tip] [Utility Script] GIO mount samba share
[root tip] [How To] Use systemd to mount ANY device
[root tip] [How To] systemd mount unit samples

And more on sharing files using samba

Search results for '#contributions:tutorials samba' - Manjaro Linux Forum

That will work automagically when you have configured your host to pass in the usb stick.

As for USB passthrough - I have no idea - it is a long time since I used Hyper-V and that was to host a virtual Exchange server for a client.

This is Manjaro Linux forum - configuring your Windows host is out of scope here.

When using mount points (in Linux) an important factor to remember is that the directory needs to already exist before you can use it.

For example, to use /mnt/hyper-v you need to create it:

sudo mkdir -p /mnt/hyper-v

In Windows, the same premise remains true;
the directory must exist before it can be used as a mount point. However, this is beyond the intended scope of the Manjaro forum.

No doubt there are abstracted methods defined according to whichever hypervisor one might use. There may be something you can glean from any of these articles:

Cheers.

Yes, the installation of the package hyperv solved the issue of missing access on network drives of the host machine, now I can access the public network drive from the inside of my VM via samba protocol.
But I guess utilizing the package cifs-utils an automated mounting via an appropriate line in /etc/fstab should now work as well. - Thanks Nachlese!

An access on removabel USB-devices seems currently be possible (only) by means of the following two options (see link Attach USB device to Hyper-V guest machine mentioned above by soundofthunder, thanks :slight_smile: ):

  • Installation of a dedicated USB-hardware and attaching this USB-HW to your VM
  • Installation of the third party software by T.D. Howard (aka tdhoward) called COMpipe on your windows machine

P.S.:
Another useful package should also be mentioned:
azure-cli (it adds the feature of multiple window sizes).

1 Like