microsoft / microsoft/WSL

WSL cannot mount VHD located on network share (smb)

Open
#7,803 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

Version

10.0.22000.318

WSL Version
  • WSL 2
  • WSL 1
Kernel Version

5.10.74.3

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps
Pre-requisite:
  • Have a smb network drive available and connect it as network drive.
  • Verify, you can write/read on that network drive.
  • Make sure, these are also mounted if the current user (admin) runs a program with elevated rights. (See here how to achieve that.)
  • Run the following steps with elevated / admin rights.
Steps to reproduce the problem:
  1. Create a virtual hard drive in VHD or VHDX format on that network drive (e.g. using Windows Disk Management). (Size and if dynamically or statically allocated does not matter.)
  2. In PowerShell or cmd.exe try to mount that virtual hard drive using wsl.exe:
    wsl.exe --mount  <path-to-vhd(x)-on-network-drive>  --vhd --bare
    
  3. Read the resulting error message.
    In German it reads:
    Der angegebene Server kann den angeforderten Vorgang nicht ausführen.
    
    Roughly translated it means:
    The specified server cannot perform the requested operation.
    
Steps for a workaround:
  1. Mount the virtual hard drive into Windows using PowerShell, thereby printing the mount name:
    Write-Output "\\.\PhysicalDrive$((Mount-VHD -Path  <path-to-vhd(x)-on-network-drive>  -PassThru | Get-Disk).Number)"
    
    Note: For the following command we assume this prints the following as the mount name:
    \\.\PhysicalDrive2
    
  2. Mount this "physical drive" into WSL:
    wsl.exe --mount \\.\PhysicalDrive2 --bare
    
  3. Go into your WSL Linux and verify that it was successfully mounted by calling lsblk.
Expected Behavior

Mounting a VHD or VHDX file from a network share should succeed as it does from a local drive.

Actual Behavior

Mounting a VHD or VHDX file from a network share does not succeed as demonstrated above.

Diagnostic Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported wsl.exe --mount <path-to-vhd(x)> --vhd --bare failure with a VHD or VHDX on an SMB network drive, then trace the WSL mount handling for network paths. Done means the network-share VHD mounts successfully through the documented command, matching the local-drive behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.