As answered here,
the command-line tool
Associates a path with a drive letter.
SUBST [drive1: [drive2:]path]
SUBST drive1: /D
drive1: Specifies a virtual drive to which you want to assign a path.
[drive2:]path Specifies a physical drive and path you want to assign to
a virtual drive.
/D Deletes a substituted (virtual) drive.
Type SUBST with no parameters to display a list of current virtual drives.
Source: A very similar question/answer
In my specific case;
- Listing the available disks in Windows
- PowerShell:
GET-CimInstance -query "SELECT * from Win32_DiskDrive"
- Command Prompt:
wmic diskdrive list brief
.
> wmic diskdrive list brief
Caption DeviceID Model Partitions Size
SK hynix PC801 HFS001TEJ9X101N \\.\PHYSICALDRIVE0 SK hynix PC801 HFS001TEJ9X101N 3 1234567890120
Samsung SSD 840 PRO Seri SCSI Disk Device \\.\PHYSICALDRIVE1 Samsung SSD 840 PRO Seri SCSI Disk Device 6 256128643216
- Mounting the drive to expose it to WSL2
.
> wsl --mount \\.\PHYSICALDRIVE1 --bare
The operation completed successfully.
- From with in WSL2 : List the partitions and their types and mount it from within WSL
.
~~~@~~~~~:/$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 388.4M 1 disk
sdb 8:16 0 4G 0 disk [SWAP]
sdc 8:32 0 1T 0 disk /snap
/mnt/wslg/distro
/
sdd 8:48 0 238.5G 0 disk
├─sdd1 8:49 0 499M 0 part
├─sdd2 8:50 0 300M 0 part
├─sdd3 8:51 0 128M 0 part
├─sdd4 8:52 0 190.1G 0 part
├─sdd5 8:53 0 31G 0 part
├─sdd6 8:54 0 15.4G 0 part
└─sdd7 8:55 0 1024M 0 part
~~~@~~~~~:/$ sudo blkid -s TYPE /dev/sdd4
/dev/sdd4: TYPE="ntfs"
~~~@~~~~~:/$ sudo blkid -s TYPE /dev/sdd5
/dev/sdd5: TYPE="ext4"
~~~@~~~~~:/$ ls /mnt/
c d wsl wslg
~~~@~~~~~:/$ sudo mkdir /mnt/g
~~~@~~~~~:/$ sudo mount -t ext4 /dev/sdd5 /mnt/g
- Navigate on Windows explorer to the folder of interest and give it a Virtual Drive name with command subst in an Admin Command Prompt:
> subst g: \\wsl.localhost\Ubuntu\mnt\g\
net help use