You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for distro root filesystem other than ext4 #9339
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:
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.
Reacted by Douglas, ak2, Leland Vakarian, artiga033, Ognyan Kulev, fcying, Luan Vitor Simião Oliveira, Theo Paris, LGDKS, Tino Didriksen and 18 more
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.
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.
I've been looking to this now that WSL has been open sourced. The relevant lines seem to be here and here.
However, I'm not sure what the best way of configuring this would be. Maybe a file system option in /etc/wsl.conf?
Reacted by Edoardo Liverani, TeamWolfyta, Wang Guan, Jimmy-Z and Douglas
I'm not sure what the best way of configuring this would be
Theo Paris (@theoparis) I think the best would be to leave it to "auto" at mount time, this means that ext4 specific mount options should be added only if it's really an ext4 I think.
Moreover /etc/wsl.conf would not be accessible when the filesystem is not yet mounted, and this config should be on a distro basis. Maybe in the registry?
During creation I don't know but a command line flag could do the work
I think the best would be to leave it to "auto" at mount time, this means that ext4 specific mount options should be added only if it's really an ext4 I think.
I don't actually know how the 'auto' detection of fs type works and if it's really precise(or if it does, why MS hardcoded the ext4 stuff?) Moreover, say when using btrfs, I may want to configure different mount options, which is common( e.g. subvol and compress). So personally I insist that we need support user config.
Maybe in the registry?
During creation I don't know but a command line flag could do the work
take a look at how they manage the default user \microsoft\WSL\src\windows\common\WslClient.cpp, though i did not find the function implmentation, but it seems finally to be stored in registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss with a subdir named by the guid of the distro.
Good news guys, I have managed to do it! Successfully installed and booted into archlinux with / mounted as btrfs. You can even see how the transparent compression saves my space.
I'm re-organizing the code and planning to make a release under my fork in several days.
But still as I have explained above, submitting and convincing Microsoft to accept the change might still be non-trivial. This includes changes to the WSL core code, the COM interface definition and the WSLg systemDistro.
Reacted by 3ri4nG0ld, Theo Paris, TeamWolfyta, Kuriko Moe, Nuno do Carmo and kkocdko
If you wish to give it a try, check my fork release here. See the release notes for detail.
I have been playing it for several hours and everything seems fine. However, I still insist you to think twice before really using it for your daily work.(For me, I have no choice because my Windows on ARM device even does not support mounting an non-root partition as an workaround, without the Windows insider channel, LOL.)
I will consider submitting a PR once I further improve the codebase (e.g., adding more CLI control options, unit tests, etc.). However, I am not a professional C++ player, so it may take a long time and be quite challenging. Any help is welcome!
Reacted by 3ri4nG0ld, Theo Paris, Kuriko Moe and slody
artiga033 great work, and went copied/copilot-ed your work into pre-release:
Great work, and I'll be testing it with some Cloud Native distros in mind and Immutable distros too.
And while I have the wsl.msi on one end, and the custom system distro on the other, somehow I cannot find the way to bundle them together as you did for your msixbundle. If you have these final step somewhere, can you share it?
Nuno do Carmo (@nunix) To build it locally you will need to change the nuget config to point to your local build of WSLg, or it will always fetch online from Microsoft release.
Activity
NotTheDr01ds commentedon Dec 20, 2022
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 commentedon Dec 26, 2022
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 commentedon Dec 26, 2022
i2 Yes, that would certainly be interesting. Where are those patches?! ;-)
i2 commentedon Dec 28, 2022
Douglas (@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: #9412
ahupp commentedon Aug 6, 2023
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 commentedon May 13, 2024
+1 I would like XFS or BTRFS for wsl root filesystem
theoparis commentedon May 20, 2025
I've been looking to this now that WSL has been open sourced. The relevant lines seem to be here and here.
However, I'm not sure what the best way of configuring this would be. Maybe a file system option in /etc/wsl.conf?
Alireza-ft commentedon May 20, 2025
EdoaLive commentedon May 27, 2025
Theo Paris (@theoparis) I think the best would be to leave it to "auto" at mount time, this means that ext4 specific mount options should be added only if it's really an ext4 I think.
Moreover
/etc/wsl.confwould not be accessible when the filesystem is not yet mounted, and this config should be on a distro basis. Maybe in the registry?During creation I don't know but a command line flag could do the work
artiga033 commentedon Jun 10, 2025
I don't actually know how the 'auto' detection of fs type works and if it's really precise(or if it does, why MS hardcoded the
ext4stuff?) Moreover, say when using btrfs, I may want to configure different mount options, which is common( e.g. subvol and compress). So personally I insist that we need support user config.take a look at how they manage the default user
\microsoft\WSL\src\windows\common\WslClient.cpp, though i did not find the function implmentation, but it seems finally to be stored in registry at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxsswith a subdir named by the guid of the distro.msuadOf commentedon Oct 28, 2025
Is there any news? Im focus on 'mount / on btrfs' recently, and think btrfs is really better than ext4 in many fields(eg. size,snapshot...).
artiga033 commentedon Oct 28, 2025
artiga033 commentedon Jan 20, 2026
Good news guys, I have managed to do it! Successfully installed and booted into archlinux with
/mounted as btrfs. You can even see how the transparent compression saves my space.I'm re-organizing the code and planning to make a release under my fork in several days.
But still as I have explained above, submitting and convincing Microsoft to accept the change might still be non-trivial. This includes changes to the WSL core code, the COM interface definition and the WSLg systemDistro.
artiga033 commentedon Jan 22, 2026
If you wish to give it a try, check my fork release here. See the release notes for detail.
I have been playing it for several hours and everything seems fine. However, I still insist you to think twice before really using it for your daily work.(For me, I have no choice because my Windows on ARM device even does not support mounting an non-root partition as an workaround, without the Windows insider channel, LOL.)
I will consider submitting a PR once I further improve the codebase (e.g., adding more CLI control options, unit tests, etc.). However, I am not a professional C++ player, so it may take a long time and be quite challenging. Any help is welcome!
nunix commentedon Feb 26, 2026
artiga033 great work, and went copied/copilot-ed your work into pre-release:
Great work, and I'll be testing it with some Cloud Native distros in mind and Immutable distros too.
And while I have the wsl.msi on one end, and the custom system distro on the other, somehow I cannot find the way to bundle them together as you did for your msixbundle. If you have these final step somewhere, can you share it?
Really great work, a massive thank you 😄
artiga033 commentedon Feb 26, 2026
Nuno do Carmo (@nunix) To build it locally you will need to change the nuget config to point to your local build of WSLg, or it will always fetch online from Microsoft release.
In my case, I have a file at
Y:\tmp\LocalNuget\Microsoft.WSLg.1.0.66-artiga.2.nupkg.As for the nuget file, I made it in a tricky way. Just download the official release from https://pkgs.dev.azure.com/shine-oss/wsl/_packaging/WslDependencies/nuget/v3/flat2/microsoft.wslg/1.0.73/microsoft.wslg.1.0.73.nupkg(change the version number as you need), unzip it(nuget packages are just zip archives), then replace the
system.vhdfiles, and finally build it into a nuget package again via nuget cli.nunix commentedon Feb 26, 2026
perfect, thanks a lot, will try it. As said, the combined pieces work already, just wanted the 1 file integration.
Thanks a lot