Mounting Linux disk on Windows
The method that succeed most is:
- Mount the drive on powershell with the bare option
wsl --mount \\.\PHYSICALDRIVE1 --bare
- On wsl, create a dir if not existent, and then mount
mkdir -p /mnt/wsl/PHYSICALDRIVE1p1
mount /dev/sdc2 /mnt/wsl/PHYSICALDRIVE1p1
Microsoft documentation states (link on the footnotes):
If you want to access a Linux disk format that isn't supported by Windows, you can use WSL 2 to mount your disk and access its content. This tutorial will cover the steps to identify the disk and partition to attach to WSL2, how to mount them, and how to access them.
- Listing connected disks
GET-CimInstance -query "SELECT * from Win32_DiskDrive"
Or
wmic diskdrive list brief
wsl --mount \.\PHYSICALDRIVE1 --partition 1 --type ext4
\wsl.localhost\Ubuntu\mnt\wsl\PHYSICALDRIVE1p1
wsl --unmount \.\PHYSICALDRIVE1
wsl install
Listing partitions on WSL
wmic diskdrive list brief
or
sudo mount /dev/sdXN /tmp/mnt
"cannot find the drive specified" error
If the following error occurs while mounting the partition:
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/HCS/0x8007000f
In sum, check if the libiscsi module is found on wsl:
wsl
sudo modprobe -v libiscsi
If the following error occurs, then you need to link the correct module.
modprobe: FATAL: Module libiscsi not found in directory /lib/modules/5.15.146.1-microsoft-standard-WSL2
Solution
I follow the instructions according to https://github.com/microsoft/WSL/issues/9290, but there is error message after executing the command "modprobe". Here is the message.
┌──(sherman㉿LAPTOP-FPRQU4NE)-[~] └─$ sudo modprobe -v libiscsi modprobe: FATAL: Module libiscsi not found in directory /lib/modules/5.15.90.1-microsoft-standard-WSL2
┌──(sherman㉿LAPTOP-FPRQU4NE)-[~] └─$ ln -s /lib/modules/5.15.90.1-microsoft-standard-WSL2+ /lib/modules/5.15.90.1-microsoft-standard-WSL2 ln: failed to create symbolic link '/lib/modules/5.15.90.1-microsoft-standard-WSL2': Permission denied
┌──(sherman㉿LAPTOP-FPRQU4NE)-[~] └─$ sudo ln -s /lib/modules/5.15.90.1-microsoft-standard-WSL2+ /lib/modules/5.15.90.1-microsoft-standard-WSL2
To solve the problem, I create the softlink directory /lib/modules/5.15.90.1-microsoft-standard-WSL2 and execute the command "modprobe" again. There is another error message. Pls refer to the following information for detail. Would you pls help me solve this problem? Thanks!
┌──(sherman㉿LAPTOP-FPRQU4NE)-[/lib/modules] └─$ sudo modprobe -v libiscsi insmod /lib/modules/5.15.90.1-microsoft-standard-WSL2/kernel/drivers/scsi/scsi_transport_iscsi.ko modprobe: ERROR: could not insert 'libiscsi': Exec format error
┌──(sherman㉿LAPTOP-FPRQU4NE)-[/lib/modules] └─$ ls -l /lib/modules total 8 drwxr-xr-x 3 root root 4096 Jun 14 10:16 5.15.90.1+ lrwxrwxrwx 1 root root 47 Jun 14 14:35 5.15.90.1-microsoft-standard-WSL2 -> /lib/modules/5.15.90.1-microsoft-standard-WSL2+ drwxr-xr-x 3 root root 4096 Jun 14 12:51 5.15.90.1-microsoft-standard-WSL2+
┌──(sherman㉿LAPTOP-FPRQU4NE)-[/lib/modules] └─$ uname -r 5.15.90.1-microsoft-standard-WSL2
As seen here