Avatar of Mr_Fulano
Flag for United States of America asked on

How to view Volumes in WSL2 on Windows 10 using Ubuntu 20.04

Hello, I just began using WSL2 in Windows 10.  I installed Ubuntu 20.04 to play around with it and am having trouble listing the Volumes on the machines. -- Granted, I know that Ubuntu is running in a virtual machines, and not the actual physical device, but I'm wondering if there is a way to list the actual volumes with something like df -h?  

*** Clarification:  df -h does list the local volumes, but not any USB devices attached to the machine. I would like to also see the external devices (i.e. /dev/disk3... ) ***

On my Mac OS (Unix) I can use diskutil list and it shows me the volume names (i.e /dev/disk1 and /dev/disk2... etc.  I can also do that with df -h and see the volume names /dev/disk1 and /dev/disk2... and so on.

So, why can't that be done within WSL2 in Windows 10?  

From what I understand Windows 11 allows for that functionality, So why not in Windows 10 or is there a way to do it in W10?

Thank you 

LinuxLinux OS DevWindows OSLinux DistributionsWindows 10

Avatar of undefined
Last Comment

8/22/2022 - Mon
Seth Simmons

...but I'm wondering if there is a way to list the actual volumes with something like df -h?

not sure if i'm missing something but doing df -h in WSL in windows 10 does show the local drives with free space
it shows the drive letter under file system and the mountpoint (under /mnt)

Hello Seth, yes... and I should have been more clear. I'll go back and edit my question with a clarification.

I would like to see the USB devices as well. df -h only shows the local disks. It won't show you the USB drives connected to the machine. (At least I don't know how to do that... hence, the point of my question here today).

Also, if you mount a USB drive, with the mount command (i.e. mount /mnt/e) as drive E:\ it will consider it a directory, not a drive. I would like to see it as a device (i.e. /dev/disk3) - a volume.   

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

Hello Serialband, I did as you suggested. I typed "mount" at the command line and I got a list but nothing with type 9p...

I also inserted a USB drive in E:\ (which is usually where my first USB drives gets assigned) and compared that to a "mount" output without a USB drive. There are no additional entries. It's the exact same output for both a USB inserted and one with a USB not inserted.

So, the question really becomes, how do you mount and unmount a USB drive in WSL if you can't see the /dev/disk# that it's assigned to?

Comment added after posting:  *** OK, I figured it out.***

 $     sudo mount -t drvfs e: /mnt/e
$      sudo umount -t drvfs e: /mnt/e

So, now.... the magic question will be if I can mount a disk image instead of a physical device.

That may become a new question. 
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck