Hyper-V

Setup shared folder

To set up a shared folder between a Windows Hyper-V host and a Debian guest, use a traditional Windows network share by creating the share on your Windows host and then accessing it from the Debian guest using SMB/CIFS and installing the client tools, such as cifs-utils.
 

  1. Share the Folder on Your Windows Host

    1. Right-click: on the folder you want to share on your Windows host computer. 
    2. Select Properties, then go to the Sharing tab. 
    3. Click Share... and grant "Everyone" read/write permissions for simplicity, or configure more granular permissions. 
    4. Note the network path of the shared folder, which will look like \\YourHostName\ShareName. 
  2. Configure the Debian Guest for Networking

    1. Ensure Network Connectivity:

      Your Debian guest must be able to communicate with the Windows host. This is usually achieved by setting up an External Virtual Switch in Hyper-V's Virtual Switch Manager, which allows the guest to connect to the physical network. 

    2. Assign IP Addresses:

      Make sure both the host and the guest have IP addresses on the same subnet so they can communicate. 

  3. Set Up the Share in the Debian Guest 

    1. Install SMB/CIFS Utilities: On your Debian guest, install the necessary tools for mounting Windows shares. sudo apt update sudo apt install cifs-utils
    2. Create a Mount Point: Create a directory in the guest where you will mount the shared folder.  sudo mkdir ~/hostshare
    3. Mount the Share: Mount the shared folder from the Windows host to the created mount point.  sudo mount -t cifs //YourHostName/ShareName ~/hostshare -o user=your_windows_username,uid=$(id -u),gid=$(id -g)
    • Replace YourHostName, ShareName, and your_windows_username with your actual details. 
    • You will be prompted for your Windows username's password. 
  4. Verify the Share 

    1. Open a terminal or file manager in your Debian guest.
    2. Navigate to the ~/hostshare directory to see the contents of the shared folder from your Windows host.