wsl --mount cannot attach a single partition of a physical drive and causes ERROR_DRIVE_LOCKED when another partition is in use.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
I encountered a disk locking issue while trying to mount a physical ext4 partition into WSL2. The physical hard drive (Disk 1) contains two partitions: one is an NTFS partition hosting the running WSL2 ext4.vhdx file, and the other is a standalone physical ext4 partition. When I ran `wsl --mount \\.\PHYSICALDRIVE1 --bare`, the system returned error 0x8007006c (the disk is in use or locked by another process). This caused a deadlock because WSL2 itself needs to access the disk that the ext4.vhdx file is currently locking.
Steps to Reproduce
1、Store a WSL2 virtual disk (ext4.vhdx) on an external drive's NTFS partition (e.g., E:\WSL\ext4.vhdx).
2、Create another independent ext4 partition on the same external physical drive.
3、Boot into this WSL2 instance from the external drive via wsl -d .
4、Open an administrator PowerShell and try to mount the physical drive to ext4powershellwsl --mount \\.\PHYSICALDRIVE1 --bare
Contributor guide
Research direction
Start by reproducing the reported setup with a WSL2 ext4.vhdx on one NTFS partition and a separate ext4 partition, then run `wsl --mount \\.\PHYSICALDRIVE1 --bare` from administrator PowerShell. The work is done when the standalone partition can be attached without ERROR_DRIVE_LOCKED or preventing the running WSL2 instance from accessing its virtual disk.
Written by the indexing model from the issue text.
Assessment
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100