microsoft / microsoft/WSL

Add support for distro root filesystem other than ext4

Open
#9,339 17 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I know ext4 is the well-supported standard, but other filesystems have so many additional features and better performance in several use cases.

From what I understand from the logs, ext4 filesystem type is somewhat hardcoded in WSL, here is what happens when I try to run a distro registered in-place with a btrfs filesystem on the VHDX:
```
[ 61.888919] EXT4-fs (sdc): VFS: Can't find ext4 filesystem
[ 61.889230] WSL (1) ERROR: Mount:1771: mount(/dev/sdc, /distro, ext4, 0x0, discard,errors=remount-ro,data=ordered
[ 61.889233] ) failed 22
[ 61.889856] WSL (1) ERROR: Invalid argument @main.cpp:2881 (ProcessMessage)
```

**Describe the solution you'd like**
The ideal world is something like WSL detects (or tells the kernel to detect) the filesystem present in the distro vhd.
Another solution could be to specify it but I don't see where you could specify such a per-distro setting outside the vhd itself (maybe in the registry?)

**Describe alternatives you've considered**
As btrfs is already supported in the original WSL2 kernel, I can mount an external btrfs vhd with `wsl --mount`, then chroot or something like that, but it's very inconvenient to do every time.

**Additional context**
I don't think this is the correct place to list the benefits of using other filesystems as distro's root, but my primary objective now is to use btrfs for its better performance, ability to enable compression and to take (and send/receive) snapshots.

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 distro mount path identified near main.cpp:2881 and reproduce the failure using a distro VHDX formatted with btrfs. Compare that path with the existing wsl --mount behavior; done means an in-place distro root filesystem can be mounted without assuming ext4.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, 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.