-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WSL2] mount "The disk is in use or locked by another process" - workaround #5997
Comments
I get the same message in my environment.
It is displayed in a Japanese message, but has the same meaning as below. Windows build number: |
I am sorry, but that the current limitation of not being able to mount a Linux partition from the Windows disk disables mounting of Linux partitions for the majority of us. |
You can, but you can't mount the whole drive with the |
I don't understand the statement above then. The way I understand the limitation is that I cannot mount a linux partition to WSL2 if the linux partition resides on the same disk as my Windows partition with efi. |
That's not what I had originally labeled the issue as, someone changed it. it's about mounting whole disks. You can mount a partition by doing this: I think the article may have been written piecemeal and that warning wasn't updated? I only used it to explain why it refuses to mount whole disks that it isn't using. |
I have same error as @noriakia when launch wsl2
Is the recently update break wsl2 down ? What change I have made to wsl2:
wsl --shutdown
diskpart
# open window Diskpart
select vdisk file="C:\WSL-Distros\…\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit Is that I only can't depart or I can't do both ? |
It hasn't been fixed even after 20231. |
Windows/Ubuntu 20.10 in the same disk, getting the same error during mount:
|
My external hard drive has three partitions: one ext4 and two NTFS. I tried to mount the ext4 partition on the external hard disk, but it shows an error that another program is using this file and the process cannot access it. `C:\Users\xxxxx>wmic diskdrive list brief C:\Users\xxxx>wsl --mount \.\PHYSICALDRIVE1 --partition 2 |
It looks like the underlying HyperV virtualizer only supports attaching
whole disks. If the disk is used by the Windows system, you can neither
attach the whole disk, nor a single partition.
|
Let me try to bring some clarity on this. WSL --mount always detaches the disk from Windows, and then attaches it as a block device to WSL2. What actually happens when
So even if In @nikitalita's scenario, I imagine that the EFI partition is on I'll close this issue now. Let me know if you have any other questions ! |
@OneBlue think you are on the right track. However, how to stop Windows from continuously attempting to mount an NTFS or FAT32 partition? Hopefully I won't have to resort to reg hacks with PHYSICALDISK settings, as I recently had to do with SDXC cards with ext4 partitions that keep coming up "format me so windows can use me" or some such nonsense. |
Having this same problem, except my windows boot is on another drive. how would you unmount this drive then? |
What I did to fix this was go to Disk Management, right-click the disk and set it to offline to unmount it. Then I was able to mount it on WSL. |
@jivanf Can confirm that also worked for me - had to use diskpart in powershell however, but same thing - set offline, then mount. |
Here's the link on how to do it through powershell |
EHM.. had the same problem and the solution is "quite simple".. before you even try to use power shell as admin to mount the disk, you "simply" have to put it offline in disk manager.. those Carrotsoft idiots either forgot to notify users about it or made it out of sheer evil joy for those who would try to do it by the book.. one stupid detail managed to put countless people to lay off of it.. |
Tried your solution, unfortunately even this didn't work and I got this MessageBox: It is not the current system disk, neither is it using slot 0! This is ridiculous |
Isn't the boot loader in the disk you are trying to mount? |
I also have this issue, is windows working on a solution? with me its because my efi partition is on the disk im trying to mount, atleast i want a solution to that, or if its some random process using it, i would like to know how to debug it |
Due to how it unmounts the whole disk and not the partition while its mounting it to WSL it fails since critical windows system files are using the C drive. Also trying to make it offline fails with "Disk attributes may not be changed on the boot disk." |
Environment
Issue
I am on a dual boot set-up with EFI enabled. I have two disks, one with my Ubuntu 20.04 install, another with my Windows install. I have my grub bootloader on the Ubuntu disk, set up to either boot me into Ubuntu or Windows.
On Windows, attempting to mount my boot disk onto my WSL 2 instance fails:
Reading the article about mounting disks into WSL 2 reveals why:
Because I was chainloading the Windows boot loader with grub, Windows considered my Ubuntu disk a boot disk, and locked the drive.
Workaround
In your motherboard settings, change the system to boot from the windows bootloader instead of the linux bootloader. Then, it won't chainload from the linux drive, and Windows won't consider it a boot disk.
The text was updated successfully, but these errors were encountered: