linuxwindows-10osdevwindows-subsystem-for-linux

mount image file system in windows subsystem for Linux


Since loop module of WSL(windows subsystem for Linux) cannot be enable, then how could I mount(or write and read by other way) the file system in disk image.


Solution

  • Your statement that loopback doesn't work in WSL is only partially correct.

    In WSL1, the way it worked was basic syscall emulation. NT ran Linux code natively, and emulated the syscalls. It was a rather simple mechanism, and it worked for quite a few programs. However, most drivers, and a lot of kernel-level code, would not work, because there was no actual Linux kernel running. (This included loopback.)

    In WSL2, however, it is simply a highly optimized Linux VM in HyperV. Thus, the full Linux kernel is being virtualized, and no Linux code was natively running in NT. Thus, everything Linux natively could do, you could most likely do in WSL2, because again, it's a full Linux kernel, and drivers mostly worked.

    Therefore, if you have WSL1, update it to WSL2, and then you can use loopback.