Posted: . At: 11:06 AM. This was 2 years ago. Post ID: 15852
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to mount a Linux formatted external drive in Windows Services for Linux on Windows 11.


I plugged my old Ubuntu HDD into an external housing and I needed to mount it in Windows Services for Linux on Windows 11. This is not too hard at all.

Firstly run this Powershell one-liner to find the drive you are looking to mount. The WDC WD10 drive is the one I wished to mount.

PS C:\Users\Intel i5> GET-CimInstance -query "SELECT * from Win32_DiskDrive"
 
DeviceID           Caption                                Partitions Size          Model
--------           -------                                ---------- ----          -----
\\.\PHYSICALDRIVE2 WDC WD10 EZEX-22MFCA0 SCSI Disk Device 2          1000202273280 WDC WD10 EZEX-22MFCA0 SCSI Disk D...
\\.\PHYSICALDRIVE1 CT500P2SSD8                            3          500105249280  CT500P2SSD8
\\.\PHYSICALDRIVE0 CT1000BX500SSD1                        1          1000202273280 CT1000BX500SSD1

This is the drive path we wish to use in this example.

\\.\PHYSICALDRIVE2

Now that we know which drive to mount, use this command as Administrator to mount it and make it accessible to WSL.

PS C:\Users\Intel i5> wsl --mount \\.\PHYSICALDRIVE2 --bare

Once inside our Linux instance in WSL, this command will list all accessible partitions that we may mount.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Videos]
└─$ lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   256G  0 disk 
sdb      8:16   0 339.7M  1 disk 
sdc      8:32   0   256G  0 disk /
sdd      8:48   0 931.5G  0 disk 
├─sdd1   8:49   0 930.7G  0 part 
└─sdd3   8:51   0   512M  0 part

Now we can mount the Linux partition inside a WSL Kali Linux instance.

┌──(john㉿DESKTOP-PF01IEE)-[/]
└─$ sudo mount /dev/sdd1 /media/

And then the files are accessible and this shows how to access a Linux formatted HDD inside Windows Services For Linux. This is a very helpful tip. Now I can access my old files easily this way and this is most helpful when using Windows 11. But using Windows Services for Linux makes everything better, you can run a Windows OS but have the ability to open graphical Linux applications on the desktop, this is very useful when testing out new Linux distributions. You just need to ensure they are a version 2 virtual machine and then the X11 applications will open seamlessly on your Windows desktop. Below is how to list what Linux distributions are installed.

PS C:\Users\Intel i5> wsl --list
Windows Subsystem for Linux Distributions:
kali-linux (Default)

Also, you may use the –verbose parameter to check the distro version.

PS C:\Users\Intel i5> wsl --list --verbose
  NAME          STATE           VERSION
* kali-linux    Running         2

This is very easy.

The wsl --list --online command will list all available Linux distributions you may install on WSL.

PS C:\Users\Intel i5> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.
 
NAME            FRIENDLY NAME
Ubuntu          Ubuntu
Debian          Debian GNU/Linux
kali-linux      Kali Linux Rolling
openSUSE-42     openSUSE Leap 42
SLES-12         SUSE Linux Enterprise Server v12
Ubuntu-16.04    Ubuntu 16.04 LTS
Ubuntu-18.04    Ubuntu 18.04 LTS
Ubuntu-20.04    Ubuntu 20.04 LTS

SUSE Linux Enterprise Server v12 would be very interesting to try out. I do wonder if you can connect a USB WIFI dongle to Kali Linux in WSL and then try to attack WIFI. I guess it could work. The only way to know is to give it a try. Running penetration testing applications from a WSL instance surely would work, maybe even Burp Suite and other advanced tools like Wireshark. That would be a lot of fun to play with.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.