WSL: wsl mount vhd not working

Version

Microsoft Windows [Version 10.0.22000.556]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.102.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

wsl --mount --vhd workdata.vhdx but if use Mount-VHD command, and mount with DiskPath will successful mount.

Expected Behavior

mount vhd successful

Actual Behavior

K:\>wsl --mount --vhd workdata.vhdx
拒绝访问。

Diagnostic Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

I found the reason for wsl return access denied. if the vhd is created under the user profile directory , the vhd owner is BUILTIN\Administrators and access is NT AUTHORITY\SYSTEM. But if the vhd is created outside the user profile directory, the vhd access will changed to BUILTIN\Administrators, then wsl --mount --vhd will get access denied. when make a copy of that vhd the owner will changed to local user and mount will succeed.

image

image

After fix vhd acl, the vhd can be mounted successfully.

The --vhd option is only available via the Store version of WSL.

my wsl is store version @benhillis 拒绝访问 means access denied

wsl --version
WSL 版本: 0.56.2.0
内核版本: 5.10.102.1
WSLg 版本: 1.0.30
MSRDC 版本: 1.2.2924
Direct3D 版本: 1.601.0
Windows 版本: 10.0.22000.556