Attachext USB to WSL - easy way - no extra software needed


jimbo45

Well-known member
Power User
VIP
Local time
10:17 AM
Posts
1,680
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi folks
Following on from my previous post of seamless integration of GUI apps with Windows one might for all sorts of reasons want to share Linux disks over your network and currently accessing the distro directly from anywhere outside the Host machine is well nigh impossible currently.

So easy "Dummies" way !!

1) ensure you've followed instructions in my previous post about running GUI apps on WSL and integrating to windows

2) start a powershell command (windows) in admin mode and enter as shown

Skjámynd 2021-12-21 131115.png

In this case ignore the error message -- that's because the file system on the disk is XFS whereas Windows wsl assumes ext4 -- doesn't matter.


3) simply from your desktop run a linux terminal --in my case konsole. No need tp start the wsl - ist time the console starts it will take a few seconds as behind the scenes the "VM" framework on windows is initialised - then it all works super fast.

4) run the lsblk and mount commands as shown -- I've created a user accessible mount point in /mnt/DV0 and chown -R userid /mnt/DV0 so user has r/w access to it.

Skjámynd 2021-12-21 131817.png


Now access from Windows : just file explorer : go to the linux directory

Skjámynd 2021-12-21 132017.png

This disk can be accessed also from remote NAS servers simply by browsing that directory on the Windows Machine !!! Caveat -- though ONLY BY RDP to the host Windows machine -- currently there's no way of accessing the WSL directly from outside it's HOST machine.

"Seemples" -- Best of both worlds -- Linux decent set of tools with decent streaming and file manager (I hate File explorer) and your favourite Windows applications --- no need for messing about with clunky VM's
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

vett93

Member
Local time
3:17 AM
Posts
10
OS
Windows 11
What is the read/write speed that can be achieved?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Corsair
    CPU
    AMD 5950x
    Motherboard
    ASRock B550 Phantom Gaming-ITX/ax
    Memory
    64GB
    Graphics Card(s)
    3080 Ti
    Monitor(s) Displays
    BenQ PD3200U
    Screen Resolution
    4K
    Hard Drives
    Samsung 2TB SSD
    PSU
    Corsair 750W Platinum
    Cooling
    water cooled CPU and GPU
    Internet Speed
    1200 Mbps down and 40 Mbps up
    Antivirus
    Windows Defender

cereberus

Well-known member
Pro User
VIP
Local time
11:17 AM
Posts
2,058
OS
Windows 10 Pro + others in VHDs
What is the read/write speed that can be achieved?
Who can possibly answer this as it depends on lots of factors e.g. drive type, pc speed etc.
 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0

vett93

Member
Local time
3:17 AM
Posts
10
OS
Windows 11
Who can possibly answer this as it depends on lots of factors e.g. drive type, pc speed etc.

One way to answer the question is using relative speed. For example, one can publish two sets of read/write speeds: one for Windows and one for WSL2.

I run tensorflow on WSL2 with Ubuntu 20.04 LTS. My desktop PC has 2 TB of SSD storage. I am trying to figure out how I should handle large datasets. WSL2 documentation states that it does not support USB drives. If OP can make it work, more power to him.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Corsair
    CPU
    AMD 5950x
    Motherboard
    ASRock B550 Phantom Gaming-ITX/ax
    Memory
    64GB
    Graphics Card(s)
    3080 Ti
    Monitor(s) Displays
    BenQ PD3200U
    Screen Resolution
    4K
    Hard Drives
    Samsung 2TB SSD
    PSU
    Corsair 750W Platinum
    Cooling
    water cooled CPU and GPU
    Internet Speed
    1200 Mbps down and 40 Mbps up
    Antivirus
    Windows Defender

jimbo45

Well-known member
Power User
VIP
Thread Starter
Local time
10:17 AM
Posts
1,680
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi there
The external USB 3 drive seems to perform more than adeqately -- I haven't measured it but I'd assume you'd probably use this in cases where you want to attach Linux formatted drives.

Note the main caveat so far with the WSL is that you can't access either it or any drives connected to it from OUTSIDE its host unless you logon to the Windows Host itself probably via RDP so this rather limits the usefulness of using a command line version of WSL for things like file serving

The problem is that the virtual WSL machine has a NAT address e.g 172.x.x.x while for proper network connectivity on your lan you need bridged mode with addresses 192.x.x.x for example. Note also that the VLAN doesn't support IPV6 although for a home network that shouldn't matter.

So probably Ms needs to improve this feature a bit more -- but this might be a false hope as if it becomes too good then it will be competing with its own HYPER-V system which still could do with a tweak or two for running non Windows VM's or pre win 7 OS'es.

Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

vett93

Member
Local time
3:17 AM
Posts
10
OS
Windows 11
.....

So probably Ms needs to improve this feature a bit more -- but this might be a false hope as if it becomes too good then it will be competing with its own HYPER-V system which still could do with a tweak or two for running non Windows VM's or pre win 7 OS'es.

Cheers
jimbo

WSL is a top feature that made me drop my Mac Pro after being 10+ years of Mac user. If Microsoft can further improve the feature, I'd imagine more people will switch over. My main use of this Windows 11 desktop is CUDA accelerated deep learning (e.g., Google's tensorflow stack) and machine learning. I need to have large store space for image files to train my ML models.

Microsoft is in an unique position for it. Hopefully, they don't screw it up.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Corsair
    CPU
    AMD 5950x
    Motherboard
    ASRock B550 Phantom Gaming-ITX/ax
    Memory
    64GB
    Graphics Card(s)
    3080 Ti
    Monitor(s) Displays
    BenQ PD3200U
    Screen Resolution
    4K
    Hard Drives
    Samsung 2TB SSD
    PSU
    Corsair 750W Platinum
    Cooling
    water cooled CPU and GPU
    Internet Speed
    1200 Mbps down and 40 Mbps up
    Antivirus
    Windows Defender
Top Bottom