Access Linux filesystems in Windows and WSL 2

Pierre Boulay

Starting with Windows Insiders preview build 20211, WSL 2 will be offering a new feature: wsl --mount. This new parameter allows a physical disk to be attached and mounted inside WSL 2, which enables you to access filesystems that aren’t natively supported by Windows (such as ext4).

So, if you’re dual booting with Windows & Linux using different disks, you can now access your Linux files from Windows!

Getting started

To mount a disk, open a PowerShell window with administrator privileges and run:

wsl --mount <DiskPath>

To list the available disks in Windows, run:

wmic diskdrive list brief

To unmount and detach the disk from WSL 2, run

wsl --unmount <Diskpath>

The disks paths are available under the ‘DeviceID’ columns. Usually under the \\.\\\.\PHYSICALDRIVE* format. Below is an example of mounting a specific partition of a given hard disk into WSL and browsing its files.

terminal with wsl text

Accessing these files with File Explorer

Once mounted, it’s also possible to access these disks through the Windows explorer by navigating to \wsl$ and then to the mount folder.

Accessing an EXT4 partition with file explorer

Limitations

By default, wsl --mount attempts to mount the disk as ext4. To specify a filesystem, or for more advanced scenarios, check out Mount a disk in WSL 2.

Also please note that this feature comes with the limitation that only physical disks can be attached to WSL 2. At this time, it’s not possible to attach a single partition. More details on the limitations here.

Give us your feedback!

If you run into any issues, or have feedback for our team please file an issue on our Github , and if you have general questions about WSL you can find all of our team members that are on Twitter on this twitter list.

42 comments

Discussion is closed. Login to edit/delete existing comments.

  • wang fengtu 0

    Is it supported WSL1 ?

    • Pierre BoulayMicrosoft employee 0

      No. wsl –mount is only supported by WSL 2.

  • Janosch Hoffmann 0

    When will this be available for windows 10 stable? Thanks.

  • Nathan Doyle 0

    How disappointing, this Insider build was pulled from service, as they found a bug (see note in the announcement.) Any other way to get this feature without having access to the build, by chance? I was really looking forward to accessing my Linux drives.

    • Pierre BoulayMicrosoft employee 0

      The latest insider build has the wsl --mount feature so you should be able to access it.

      • Natetronn 0

        Thanks for that.

        Okay, I’ve switched to the dev branch and am downloading 20231 as I write this.

        This is the only features I need and although I chose not to wait, as I have many ext4 drives, I’d really like to be back on stable again. That said, can I leave Insiders at some point and be back to stable, say, if stable catches up and reaches 20231 will I be moved back again? How does all that work? If nothing else, at least for the time being, I think I’ll move to the beta channel.

        • Craig LoewenMicrosoft employee 0

          Jumping in to help with this question:

          Yes you can leave Insiders at any point and be back to stable! The only stipulation here is that you can’t go backwards to an older Windows release. So for your use case it’d probably make sense to start in the Dev Channel (which gives new builds each week) to get access to wsl –mount, and then in the future you can change your settings to the beta channel and from there you’ll only get new updates when they’re pushed to that channel.

          • Natetronn 0

            That’s great, thanks Craig!

            I’m testing the feature out as we speak…

            Okay, I ran into an issues and will detail why and how I fixed it:

            The code above is missing any reference to the –partition flag, although I now see it’s in the image. I’m leaving this here for others, should they run into the same issue and or until the code above has been clarified.

            I get an error and am told:

            The disk \\.\PHYSICALDRIVE3 was attached from WSL2, but failed to mount (error code: -1). For more details, run 'dmesg' inside WSL2.

            Which I narrow down to the the following (I typed wsl to enter the default SubSystem, then ran dmesg ):

            [  894.810659]  sde: sde1
            [  894.811445] EXT4-fs (sde): VFS: Can't find ext4 filesystem
            [  894.811493] ERROR: Mount:2564: mount(/dev/sde, /share/PHYSICALDRIVE3, ext4, 0x0, ) failed
            

            Which I searched for and then realized I needed the partition flag, thanks to this SV answer:

            https://serverfault.com/a/618533

            Anyway, it appears I’ve had a successful mount running the following:

            wsl --mount \\.\PHYSICALDRIVE3 --partition 1

            Note for others: change \\.\PHYSICALDRIVE3 and –partition 1 to your drive and partition number, of course.

  • Radu Tomuleasa 0

    When is this coming to stable release of Windows 10? I need this, but don’t want to go to Dev Preview on my main dev machine.

  • Neo Yang 0

    “At this time, it’s not possible to attach a single partition.” is confusing me.

    But the sample you demonstrates does mount a single partition to wsl.

    So may I know what’s real limitation of that?

    • Pierre BoulayMicrosoft employee 0

      What is meant by that statement is that it’s not possible to have one partition attached to WSL 2 while the disk is in use in Windows.

      Concretely, this means that the entire disk must be attached to WSL 2, regardless of which partitions are mounted in there.

Feedback usabilla icon