microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.56k stars 823 forks source link

Add support for distro root filesystem other than ext4 #9339

Open EdoaLive opened 1 year ago

EdoaLive commented 1 year ago

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.

NotTheDr01ds commented 1 year ago

I'm all in favor of this, but I do have a curiosity question since you seem to have already tried it out. How is btrfs performance under WSL2? Any benchmarks?

I'd like to see it just for the snapshot capability, but it would be interesting to know what the performance delta is compared to WSL2's ext4.

i2 commented 1 year ago

A semi-related news related to WSL performance which might interest you is that new patches are released to boost Linux 9p performance about 10 times!

NotTheDr01ds commented 1 year ago

@i2 Yes, that would certainly be interesting. Where are those patches?! ;-)

i2 commented 1 year ago

@NotTheDr01ds You can find the new patch series here:

https://lore.kernel.org/lkml/20221218232217.1713283-1-evanhensbergen@icloud.com/ https://github.com/v9fs/linux/tree/ericvh/9p-next

Update: I have posted a discussion here: https://github.com/microsoft/WSL/discussions/9412

ahupp commented 1 year ago

I've love to see this as well. Right now I have some hacky startup scripts to mount a vhdx disk image and then mount that onto /home, but my setup would be simpler if the whole root filesystem could be btrfs.

jtherin commented 6 months ago

+1 I would like XFS or BTRFS for wsl root filesystem