WSL2 - Avoid using Jekyll on Windows Filesystem
If any of you find Jekyll compile-time(bundle exec jekyll serve
) is too slow on your Windows - WSL environment, make sure that your blog is NOT located on Windows Filesystem!
TL;DR
WSL2 is very slow in Windows filesystem (/mnt/c
).
Clone your blog repo to the Linux filesystem (starting with ~/
).
Access Linux filesystem via explorer with a path like below.
\\wsl$\{distro_name}\home\{user_name}
# My case
\\wsl$\Ubuntu\home\lazyren
Windows Filesystem
There is a known issue WSL2 filesystem performance is much slower than WSL2 in /mnt.
That being said, simple Jekyll compile takes about 40 seconds with my brand new $3000 computer.
Solution? Migrate your blog to the Linux filesystem. Re-clone your repo.
Linux Filesystem
By simply migrating to the Linux filesystem, the compile-time has been reduced to 1/10(2.6 sec).
But you need some settings to fully take advantage of WSL2.
Additional Settings
Explorer
We need to navigate to the folder freely with explorer.
Access Linux filesystem via explorer with a path like below.
\\wsl$\{distro_name}\home\{user_name}
# My case
\\wsl$\Ubuntu\home\lazyren
Make a shortcut to the blog folder or root folder for the future.
Windows Terminal
Change starting directory to the root folder of the user. Add the below line to the ubuntu profile from settings.json
.
//file: "settings.json"
"startingDirectory": "//wsl$/Ubuntu/home/lazyren"
# Profile will look like below.
# {
# "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
# "hidden": false,
# "name": "Ubuntu",
# "source": "Windows.Terminal.Wsl",
# "startingDirectory": "//wsl$/Ubuntu/home/lazyren"
# }