I created a new VHDX using disk manager, and I’m trying to mount it to WSL2, running the following command:
wsl -d Ubuntu-22.04 --mount --vhd D:wsl2wsl2-drive.vhdx --bare
It fails with:
Failed to attach disk '\?D:wsl2wsl2-drive.vhdx' to WSL2: Access is denied.
Error code: Wsl/Service/AttachDisk/MountVhd/E_ACCESSDENIED
Things I tried which didn’t make a difference:
- Run it from an elevated PowerShell
- Create a VHD instead of a VHDX
- Leaving out
--bare
- Having the VHDX is various different states:
- “Not Initialized / Unallocated”: the state after creating in disk manager
- Choose ‘Initialize disk’ in Disk Manager
- Create a partition (but that feels wrong, since it shouldn’t be NTFS for Linux?)
- Detach it altogether in Disk Manager