WSL cannot mount VHD located on network share (smb)
Open
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:
- 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.)
- In PowerShell or
cmd.exetry to mount that virtual hard drive usingwsl.exe:wsl.exe --mount <path-to-vhd(x)-on-network-drive> --vhd --bare - Read the resulting error message.
In German it reads:
Roughly translated it means:Der angegebene Server kann den angeforderten Vorgang nicht ausführen.The specified server cannot perform the requested operation.
Steps for a workaround:
- Mount the virtual hard drive into Windows using PowerShell, thereby printing the mount name:
Note: For the following command we assume this prints the following as the mount name:Write-Output "\\.\PhysicalDrive$((Mount-VHD -Path <path-to-vhd(x)-on-network-drive> -PassThru | Get-Disk).Number)"\\.\PhysicalDrive2 - Mount this "physical drive" into WSL:
wsl.exe --mount \\.\PhysicalDrive2 --bare - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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