After installing zfs the following output is returned when running zfs list
:
user@machine:~$ zfs list
The ZFS modules are not loaded.
Try running '/sbin/modprobe zfs' as root to load them.
user@machine:~$ sudo /sbin/modprobe zfs
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microsoft-standard/modules.dep.bin'
modprobe: FATAL: Module zfs not found in directory /lib/modules/4.19.84-microsoft-standard
How to user zfs with WSL2?
Essentially, this error occurs because the ZFS Modules need to be built into the kernel, and the WSL2 kernel does not currently have ZFS Modules included. Thankfully, there is a great tutorial on wsl.dev that covers manually building the kernel with ZFS. I don't fully understand how it works, but just following the steps was easy enough: https://wsl.dev/wsl2-kernel-zfs/
Took me about 2 hours to walk through, but I did a bunch of research along the way ;)