microsoft / microsoft/WSL

Enable complete mounting of RAID devices

Open
#5,999 16 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature kconfig
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 14h
Merged PRs (30d)
107

Description

Is your feature request related to a problem? Please describe.
Recently, WSL2 got support for mounting physical disks, which is great. I have 2 disks from a previous Ubuntu server that were set up in software RAID1 in Linux (partition type "linux_drive_member"), and decided to leverage the recently added support and have them show up in Windows, instead of switching their file system to something like NTFS, which Windows supports natively (risk of losing files etc). I could mount the disks using:

wsl --mount \\.\PHYSICALDRIVE4 --bare
wsl --mount \\.\PHYSICALDRIVE5 --bare

Then, in Linux, I tried assembling the array using mdadm: sudo mdadm --assemble /dev/md0 /dev/sdc1 /dev/sdd1, but the following error is returned:

modprobe: FATAL: Module md_mod not found in directory /lib/modules/4.19.128-microsoft-standard
mdadm: Fail create md0 when using /sys/module/md_mod/parameters/new_array
mdadm: unexpected failure opening /dev/md0

That's because the wsl2 kernel is compiled without RAID support. To fix this, one has to clone the kernel from WSL2-Linux-kernel, run make KCONFIG_CONFIG=Microsoft/config-wsl menuconfig, choose "Device Drivers - Multiple devices driver support (RAID and LVM)", and from there, press y on "RAID support", and, in my case, "RAID-1 (mirroring) mode". Then, make KCONFIG_CONFIG=Microsoft/config-wsl to compile the kernel, and set it as the loaded kernel as described here: https://docs.microsoft.com/en-us/windows/wsl/wsl-config.

Now, when running mdadm, it succeeds. What remains is to mount /dev/md0 (for me, it is an ext4 partition) to some directory, in my case: sudo mount /dev/md0 /mnt. All works well, files can be accessed from wsl2. The problem is that when using File Explorer to go to "\\wsl\Ubuntu\mnt", the directory is empty. This is kind of expected, but how to go about it? How to mount things in Linux so that they get mounted in the wsl$ network share as well, and be available from Windows? I tought about specifing it in /etc/fstab and specifying the mountFsTab option in .wslconfig, but the array is not ready at boot (I have to execute those 2 "wsl.exe --mount ..." commands to mount the physical disks inside WSL).

Describe the solution you'd like
Most importantly, a way to properly mount things in WSL and have them show up in Windows, using the network share, as well. Also, you could enable RAID support for the kernel by default, although it was not that hard to compile it (took 4 minutes), and maybe that's not required for most users and you aim for a lightweight kernel after all.

Describe alternatives you've considered
For now, I'll install samba and temporarily have the folder available though that in Windows, although I do not like it as I have to spend time configuring it.

Additional context
Thanks for the great work you are doing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WSL kernel configuration at Microsoft/config-wsl and the wsl --mount flow described in the issue, then trace how mdadm-created /dev/md0 mounts are exposed under /mnt and the \wsl share. Compare the behavior with the mountFsTab and .wslconfig references; done means a RAID-backed filesystem is available through File Explorer, or the supported limitation and required setup are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.