You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any ETA on when we can see block devices such as sda, for tools like hdparm ?
Thanks
Reacted by Unknown6656, ajthemacboy, Pierre Beaucamp, Jürgen Hörmann, Eduard Martinescu, woltiw, Wade Menard, Andrei Bîscă, Frank Breitling, Michel Albert and 282 more
Reacted by John Fred Fadrigalan, cmd430, Albin Mouton and James Keller
Reacted by John Fred Fadrigalan, Anton Tolstov, Albin Mouton, Danir Toma, Jack, James Keller and wnmgo
Unfortunately I can't give an ETA on this one. We know there is a desire to be able to access block devices from WSL but it is not terribly high on our priority list at the moment. As Sunil Muthuswamy (@sunilmut) points out, the best thing to do here would be to add something to our User Voice page. Little secret, one thing that always helps the requests there is explaining the actual scenario you're looking to enable.
Reacted by Julie, Tony Apuzzo, ntopower2 and Joseph Davies
Reacted by Bruno Klein Salvalaio, Hashim Aziz, Nufflee, Franz Josef Kaiser, Michael Moravec, Arun Woosaree, Paulo Freitas, Martín Cigorraga, Arthur Finkelmann, Ersi Ni and 28 more
Russ Alexander (@russalex) Is there really a point to this kind of thing? It's in the nature of the thing that it is going to be served a pre-assembled abstracted filesystem. Loading up something like dd while Windows mounts the disk (in non-raw mode) seems like it could be a problem, and this kind of thing seems to require effectively writing hardware drivers that negotiate hardware access between WSL and WSWin32
Reacted by S, Vincent Vermilya, John Fred Fadrigalan, Aaron Kunde and Stewart Stewart
fpqc, While we know there is some desire for this feature, it's not been enough of a priority for us to discuss planning or implementation.
What is interesting to me is to hear what people want to do with these types of features. The users of this forum often surprise me with their creativity and the more information we get the better. I have found that it never hurts to at least hear someone out. If something is compelling enough, and enough people want it, then we should at least look into feasibility and see where we may be able to fit it into plans.
I would love to have access to block devices from WSL but it would require strict restrictions (like disallow write from devices mounted from windows/wsl). There is a high risk of corruption if a peripheral is already mounted :(
Reacted by fpqc, ░▒▓█│【Walkman】│█▓▒░, Václav Brožík, stesix and read with ai
Well actually, raw disk access would make it possible to leverage device-mapper, mdraid and LVM to access any existing linux disks/logical volumes in/on your system.
I agree that it should be restricted to disks not already mounted.
Reacted by metarmask, Alexander Justin Kerchum, Vincent Vermilya, Yishen Miao, Václav Brožík, Alicja, sevaseva, Aetf, Zav Shotan, LowEyeQueue and 9 more
It's device-mapper driver that's in the kernel, but yeah, that would be needed.
~$ sudo pvs
/dev/mapper/control: mknod failed: Function not implemented
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
/proc/devices: fopen failed: No such file or directory
Failed to create lvm type filter
But there would be need of something similar anyway to support access to disks like in the original question by OP.
I would love to have access to partition types that don´t have native support on Windows.( e.g. mount a ext4 partition)
Another user case is to use "parted" for modify removable disks (after desatach them from using the disk manager, of course)
Reacted by Václav Brožík, Alicja, David Dyck, Kenny Strawn, Maxi Herczegh, Aris Boch, Mr Beedell, Roke Julian Lockhart and jaredlovell
JuanDavi Evora Hanggi (@jdevora) This would necessarily be beyond the scope of WSL. The first thing would be the extension of WSL's ability to mount different partition types in general, maybe with a way to query the NT kernel about "FS capabilities" (which I suspect already exists, but probably does not exist with information about Linux FS feature support). Then you would also need to write a kernel-mode driver (or maybe somehow use FUSE?) supporting ext4. The first thing might be within the scope of WSL. The second probably isn't.
This allows me to manages the fileystems of embedded devices runing linux directly (for example I can run something like mkfs.ext2 /dev/sdc1or copy a firmware to the ꜱᴅ card using dd)
Would it be possible to have the same feature on Windows subsystem for Linux ? Please note I don’t want to be able to mount the filesystems, but just read and write to their device files. That is, getting a raw access in the kiss way.
Otherwise, wsl isn’t a good platform for building and loading firmwares on the ꜱᴅ card.
Reacted by Pierre Beaucamp, Leandro Piccilli, gmd20, Dylan Bartlett, Alexander Justin Kerchum, badjr, EricWardner, Christopher Yeleighton, Anton Skavronskij, Mikhail Titov and 30 more
Reacted by Jaguar83, Dave Orme, Jolly, Maciej Kwidziński, Albin Mouton, John-Appleseed and Dane Bouchie
Am I understanding properly that even if MS found a way to allow the subsystem direct device access, standard linux filesystem kernel modules would not be usable with the subsystem's customized kernel?
I was hoping we could mount the foreign filesystems which windows does not support otherwise and then export them with smbd - like it was possible to do with the old colinux project - but I guess this is too far off into the future for now.
If fuse support in LXSS is easier to implement, being a single thing as opposed to the various possible linux kernel filesystem drivers, it could be pretty great - even though core linux filesystems that have kernel modules don't seem to have fuse drivers yet because there was never any need for them, they can probably be developed once there is a use-case for them in LXSS.
Yes, as it's not a real kernel, filesystems included from linux kernel will not be usable (or MS have to rewrite them). But if they implement fuse, I think we will see ext2/3/4 comming to fuse :)
And yes, it would be exportable to SMB :D
For me, I just want to use dd without having to go to Linux. I can't use a livecd easily because I don't have a flash drive, and my usb drive isn't recognizing on windows tools (though I can see G/: in the explorer, though it freezes). So this was hopefully my last attempt to get it to work. (Not sure it'll necessarily work, but there are similar use-cases to this)
For others, it's also useful for formatting a drive using linux, (without having to go through the trouble of a dual boot / livecd)
For me, I just want to use dd without having to go to Linux. I can't use a livecd easily because I don't have a flash drive, and my usb drive isn't recognizing on windows tools (though I can see G/: in the explorer, though it freezes). So this was hopefully my last attempt to get it to work. (Not sure it'll necessarily work, but there are similar use-cases to this)
For others, it's also useful for formatting a drive using linux, (without having to go through the trouble of a dual boot / livecd)
Maybe Cygwin will be able to help you with that. I vaguely remember dd working there, but it has been a long time.
For me, I just want to use dd without having to go to Linux. I can't use a livecd easily because I don't have a flash drive, and my usb drive isn't recognizing on windows tools (though I can see G/: in the explorer, though it freezes). So this was hopefully my last attempt to get it to work. (Not sure it'll necessarily work, but there are similar use-cases to this)
For others, it's also useful for formatting a drive using linux, (without having to go through the trouble of a dual boot / livecd)
Maybe Cygwin will be able to help you with that. I vaguely remember dd working there, but it has been a long time.
Can confirm that it works fine, I've been using it for half a decade. I tried my best to move to WSL2 but it has too many failings compared to Cygwin, so I'll probably stay on Cygwin for at least another 5 years.
Just wanted to say - I've been tethered to a virtual machine at work for years, needing a working Linux dev environment for an embedded product. Decided to migrate to WSL2 earlier this year when I'd seen how far it had come. Somehow, I never ran into this issue before now, and man it is very disappointing to have to fire that VM up again.
Just wanted to say - I've been tethered to a virtual machine at work for years, needing a working Linux dev environment for an embedded product. Decided to migrate to WSL2 earlier this year when I'd seen how far it had come. Somehow, I never ran into this issue before now, and man it is very disappointing to have to fire that VM up again.
same here. wsl got everything done in the petalinux toolchain, only to be punted back to a vm to format the sd card :(
While usbipd helps immensely for mounted file systems shared with the host (Win11 OS) it does not help with physical device (as in /dev/mmblk0p1) access as much.
Tools that embedded devs use are
dd
cfdisk
and scripts that build images for the target system.
Windows commands to get the physical device name (like \.\PHYSICALDRIVE2 ) - don't really translate well to handles WSL 2 clients use
EX:
c:> GET-CimInstance -query "SELECT * from Win32_DiskDrive"
DeviceID Caption Partitions Size Model
\.\PHYSICALDRIVE2 TS-RDF8 SD Transcend USB Device 1 30935278080 TS-RDF8 SD Transcend USB Device
\.\PHYSICALDRIVE1 TS-RDF8 CF Transcend USB Device 0 TS-RDF8 CF Transcend USB Device
\.\PHYSICALDRIVE0 CT2000P5PSSD8 5 2000396321280 CT2000P5PSSD8
TS-RDF8 SD Transcend USB Device \.\PHYSICALDRIVE2 USB 30935278080
Linux File-Stor Gadget USB Device \.\PHYSICALDRIVE4 USB 115153920
TS-RDF8 CF Transcend USB Device \.\PHYSICALDRIVE1 USB
freescale USB Device \.\PHYSICALDRIVE3 USB 4079738880
Resorting to creating a local image file and then mounting (each filesystem needed in the boot disk) it, formatting, and placing images in the image file (that is partitions for different file system) rather than to the direct physical drive is an option.
Then copying it to windows and using an image writer tool like rufus or others seems the only workaround.
RGulde (@RGulde) I'm not sure I follow. The way I use usbipd, the filesystem is not shared with Windows, and it does show up as /dev/<blah> inside of WSL. I can use dd just fine.
Sometimes, for reasons I have not yet been able to discover, you need
C:\Users> usbipd bind --force -b <bus id>
Which will necessitate a reboot, and prevent Windows from accessing that device at all. At the end, though, it just shows up as a block device in WSL:
user in ~ λ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 389.8M 1 disk
sdb 8:16 0 2G 0 disk [SWAP]
sdc 8:32 0 1T 0 disk /snap
/mnt/wslg/distro
/
sdd 8:48 1 0B 0 disk
sde 8:64 1 14.8G 0 disk <-- Here!
└─sde1 8:65 1 14.8G 0 part
In order to get this working, I did need to custom compile the WSL kernel. If I recall correctly, Microsoft has made the irritating decision to support this out of the box on Win11, but not backport the kernel config to Win10 WSL. The usbipd wiki has more information.
wsl --mount --bare allows a physical disk to be attached to WSL2 and accessible as a block device. Once attached, tools like dd, parted & others can be used.
In case of disks that e.g. have a linux install and have no drive letter, use wmic diskdrive list brief to get the device IDs of your disks and then use the \\.\PHYSICALDRIVE# path as the argument to wsl --mount --bare, works like a charm!
I'm not sure I follow. The way I use usbipd, the filesystem is not shared with Windows, and it does show up as /dev/<blah> inside of WSL. I can use dd just fine.
In order to get this working, I did need to custom compile the WSL kernel. If I recall correctly, Microsoft has made the irritating decision to support this out of the box on Win11, but not backport the kernel config to Win10 WSL. The usbipd wiki has more information.
I'm on Windows 11 and it does not show in lsblk, only lsusb. I would very much like to know what you did to your WSL kernel to get this block device to show up. I did force-bind and attach the USB MSD.
part of my dmesg:
[ 92.370629] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[ 92.370634] vhci_hcd vhci_hcd.0: devid(393220) speed(5) speed_str(super-speed)
[ 92.370691] vhci_hcd vhci_hcd.0: Device attached
[ 92.718151] usb 2-1: SetAddress Request (2) to port 0
[ 92.718161] usb 2-1: new SuperSpeed USB device number 2 using vhci_hcd
[ 92.769955] usb 2-1: New USB device found, idVendor=8564, idProduct=4000, bcdDevice= 0.2a
[ 92.769961] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[ 92.769964] usb 2-1: Product: Transcend
[ 92.769965] usb 2-1: Manufacturer: TS-RDF8
[ 92.769967] usb 2-1: SerialNumber: 000000079
Christoph Rackwitz (@crackwitz) If you're not seeing any block devices in /dev, make sure your kernel was compiled with USB mass storage drivers enabled. Check the config in /proc/config.gz
I follow this for disks such as hard drives, SSDs, etc, but I'm trying to mount a DVD drive as a block device. I tried using the physical path of \\.\CdRom0\ and either get an "Access is denied" or a "Incorrect Function", I even removed the drive letter from Windows just in case. Is there something different or are optical drives not available via "wsl --mount" ?
I tried using Andrew Leech's WSL USB (gui for usbipd) but I still struggled getting using dd in WSL. I tried using Cygwin instead and it worked easily. Also pv seems much faster than dd for making an image from a usb device. (Commenting here because this was a top google result for the issue).
Several years later, another obligatory check back to see whether this now decade-old, relatively basic and highly-requested feature has been implemented yet. Cygwin is getting old in the tooth and this feature is currently the only thing stopping me from upgrading to Windows 11 because I don't want to have run the several usbpid commands above everytime I need to securely wipe a drive or do any other low-level drive operations. If the devs are worried about making this behaviour open to the average Windows user it could be made opt-in via a Bash variable or system setting, while still making things usable for power users who know what they're doing... and WSL2 in its own right tends to be installed by those users anyway. But since so far it seems the devs have no interest in implementing this feature at all, maybe this is an opportunity to move to Linux Mint instead.
I tried using Andrew Leech's WSL USB (gui for usbipd) but I still struggled getting using dd in WSL. I tried using Cygwin instead and it worked easily. Also pv seems much faster than dd for making an image from a usb device. (Commenting here because this was a top google result for the issue).
dd is an old tool with old defaults, specifically a block size of 512 bytes for compatibility reasons. It needs to be used with at least bs=4M to get any reasonable level of speed on modern drives.
Activity
sunilmut commentedon Jul 28, 2016
Thanks for the feedback. Russ Alexander (@russalex) or Rich Turner (@bitcrazed) might be able to comment on any ETA's (or the lack of it). Also, please also make any feature requests on our User Voice Page and help us prioritize.
russalex commentedon Jul 28, 2016
Unfortunately I can't give an ETA on this one. We know there is a desire to be able to access block devices from WSL but it is not terribly high on our priority list at the moment. As Sunil Muthuswamy (@sunilmut) points out, the best thing to do here would be to add something to our User Voice page. Little secret, one thing that always helps the requests there is explaining the actual scenario you're looking to enable.
fpqc commentedon Jul 31, 2016
Russ Alexander (@russalex) Is there really a point to this kind of thing? It's in the nature of the thing that it is going to be served a pre-assembled abstracted filesystem. Loading up something like dd while Windows mounts the disk (in non-raw mode) seems like it could be a problem, and this kind of thing seems to require effectively writing hardware drivers that negotiate hardware access between WSL and WSWin32
russalex commentedon Aug 1, 2016
fpqc, While we know there is some desire for this feature, it's not been enough of a priority for us to discuss planning or implementation.
What is interesting to me is to hear what people want to do with these types of features. The users of this forum often surprise me with their creativity and the more information we get the better. I have found that it never hurts to at least hear someone out. If something is compelling enough, and enough people want it, then we should at least look into feasibility and see where we may be able to fit it into plans.
jtherin commentedon Aug 12, 2016
I would love to have access to block devices from WSL but it would require strict restrictions (like disallow write from devices mounted from windows/wsl). There is a high risk of corruption if a peripheral is already mounted :(
finkelamein commentedon Aug 12, 2016
Well actually, raw disk access would make it possible to leverage device-mapper, mdraid and LVM to access any existing linux disks/logical volumes in/on your system.
I agree that it should be restricted to disks not already mounted.
fpqc commentedon Aug 12, 2016
Quattro (@finkelamein) idk about that, I think the LVM driver is baked into the Linux Kernel.
finkelamein commentedon Aug 12, 2016
It's device-mapper driver that's in the kernel, but yeah, that would be needed.
But there would be need of something similar anyway to support access to disks like in the original question by OP.
jdevora commentedon Aug 23, 2016
I would love to have access to partition types that don´t have native support on Windows.( e.g. mount a ext4 partition)
Another user case is to use "parted" for modify removable disks (after desatach them from using the disk manager, of course)
fpqc commentedon Aug 23, 2016
JuanDavi Evora Hanggi (@jdevora) This would necessarily be beyond the scope of WSL. The first thing would be the extension of WSL's ability to mount different partition types in general, maybe with a way to query the NT kernel about "FS capabilities" (which I suspect already exists, but probably does not exist with information about Linux FS feature support). Then you would also need to write a kernel-mode driver (or maybe somehow use FUSE?) supporting ext4. The first thing might be within the scope of WSL. The second probably isn't.
ytrezq commentedon Sep 25, 2016
On Cygwin I can use
/dev/sdXX files directly.This allows me to manages the fileystems of embedded devices runing linux directly (for example I can run something like
mkfs.ext2 /dev/sdc1or copy a firmware to the ꜱᴅ card usingdd)Would it be possible to have the same feature on Windows subsystem for Linux ?
Please note I don’t want to be able to mount the filesystems, but just read and write to their device files. That is, getting a raw access in the kiss way.
Otherwise, wsl isn’t a good platform for building and loading firmwares on the ꜱᴅ card.
georgir commentedon Nov 25, 2016
Am I understanding properly that even if MS found a way to allow the subsystem direct device access, standard linux filesystem kernel modules would not be usable with the subsystem's customized kernel?
I was hoping we could mount the foreign filesystems which windows does not support otherwise and then export them with smbd - like it was possible to do with the old colinux project - but I guess this is too far off into the future for now.
If fuse support in LXSS is easier to implement, being a single thing as opposed to the various possible linux kernel filesystem drivers, it could be pretty great - even though core linux filesystems that have kernel modules don't seem to have fuse drivers yet because there was never any need for them, they can probably be developed once there is a use-case for them in LXSS.
jtherin commentedon Nov 25, 2016
Yes, as it's not a real kernel, filesystems included from linux kernel will not be usable (or MS have to rewrite them). But if they implement fuse, I think we will see ext2/3/4 comming to fuse :)
And yes, it would be exportable to SMB :D
96 remaining items
MolotovCherry commentedon Jan 9, 2023
For me, I just want to use dd without having to go to Linux. I can't use a livecd easily because I don't have a flash drive, and my usb drive isn't recognizing on windows tools (though I can see G/: in the explorer, though it freezes). So this was hopefully my last attempt to get it to work. (Not sure it'll necessarily work, but there are similar use-cases to this)
For others, it's also useful for formatting a drive using linux, (without having to go through the trouble of a dual boot / livecd)
ryao commentedon Jan 9, 2023
Maybe Cygwin will be able to help you with that. I vaguely remember dd working there, but it has been a long time.
hashimaziz1 commentedon Jan 9, 2023
Can confirm that it works fine, I've been using it for half a decade. I tried my best to move to WSL2 but it has too many failings compared to Cygwin, so I'll probably stay on Cygwin for at least another 5 years.
fpf3 commentedon Jun 6, 2023
Just wanted to say - I've been tethered to a virtual machine at work for years, needing a working Linux dev environment for an embedded product. Decided to migrate to WSL2 earlier this year when I'd seen how far it had come. Somehow, I never ran into this issue before now, and man it is very disappointing to have to fire that VM up again.
cheesyh commentedon Dec 18, 2023
same here. wsl got everything done in the petalinux toolchain, only to be punted back to a vm to format the sd card :(
fpf3 commentedon Dec 18, 2023
Kyle Hagen (@cheesyh) I actually managed to get around this by using usbipd.
RGulde commentedon Feb 1, 2024
While usbipd helps immensely for mounted file systems shared with the host (Win11 OS) it does not help with physical device (as in /dev/mmblk0p1) access as much.
Tools that embedded devs use are
dd
cfdisk
and scripts that build images for the target system.
Windows commands to get the physical device name (like \.\PHYSICALDRIVE2 ) - don't really translate well to handles WSL 2 clients use
EX:
c:> GET-CimInstance -query "SELECT * from Win32_DiskDrive"
DeviceID Caption Partitions Size Model
\.\PHYSICALDRIVE2 TS-RDF8 SD Transcend USB Device 1 30935278080 TS-RDF8 SD Transcend USB Device
\.\PHYSICALDRIVE1 TS-RDF8 CF Transcend USB Device 0 TS-RDF8 CF Transcend USB Device
\.\PHYSICALDRIVE0 CT2000P5PSSD8 5 2000396321280 CT2000P5PSSD8
c:> Get-WmiObject Win32_diskdrive | Select Caption,DeviceID,InterfaceType,Size | Where-Object {$_.InterfaceType -eq "USB"}
Caption DeviceID InterfaceType Size
TS-RDF8 SD Transcend USB Device \.\PHYSICALDRIVE2 USB 30935278080
Linux File-Stor Gadget USB Device \.\PHYSICALDRIVE4 USB 115153920
TS-RDF8 CF Transcend USB Device \.\PHYSICALDRIVE1 USB
freescale USB Device \.\PHYSICALDRIVE3 USB 4079738880
Resorting to creating a local image file and then mounting (each filesystem needed in the boot disk) it, formatting, and placing images in the image file (that is partitions for different file system) rather than to the direct physical drive is an option.
Then copying it to windows and using an image writer tool like rufus or others seems the only workaround.
Man, computers make things easier, Microsoft could wrap (https://en.wikipedia.org/wiki/Amoeba consume?) Linux systems when they get this right. Yes, I realize they have Linux source code - but this would give them instant access to all of what free software foundation folks have been working on forever.
fpf3 commentedon Feb 1, 2024
RGulde (@RGulde) I'm not sure I follow. The way I use
usbipd, the filesystem is not shared with Windows, and it does show up as/dev/<blah>inside of WSL. I can useddjust fine.Sometimes, for reasons I have not yet been able to discover, you need
Which will necessitate a reboot, and prevent Windows from accessing that device at all. At the end, though, it just shows up as a block device in WSL:
In order to get this working, I did need to custom compile the WSL kernel. If I recall correctly, Microsoft has made the irritating decision to support this out of the box on Win11, but not backport the kernel config to Win10 WSL. The
usbipdwiki has more information.andsens commentedon Feb 15, 2024
In case of disks that e.g. have a linux install and have no drive letter, use
wmic diskdrive list briefto get the device IDs of your disks and then use the\\.\PHYSICALDRIVE#path as the argument towsl --mount --bare, works like a charm!crackwitz commentedon Apr 25, 2024
Fred Frey (@fpf3)
I'm on Windows 11 and it does not show in
lsblk, onlylsusb. I would very much like to know what you did to your WSL kernel to get this block device to show up. I did force-bind and attach the USB MSD.part of my
dmesg:fpf3 commentedon Apr 25, 2024
Christoph Rackwitz (@crackwitz) If you're not seeing any block devices in
/dev, make sure your kernel was compiled with USB mass storage drivers enabled. Check the config in/proc/config.gzjeffe210 commentedon Aug 26, 2024
I follow this for disks such as hard drives, SSDs, etc, but I'm trying to mount a DVD drive as a block device. I tried using the physical path of \\.\CdRom0\ and either get an "Access is denied" or a "Incorrect Function", I even removed the drive letter from Windows just in case. Is there something different or are optical drives not available via "wsl --mount" ?
evnb commentedon Mar 7, 2025
I tried using Andrew Leech's WSL USB (gui for usbipd) but I still struggled getting using dd in WSL. I tried using Cygwin instead and it worked easily. Also pv seems much faster than dd for making an image from a usb device. (Commenting here because this was a top google result for the issue).
hashimaziz1 commentedon Apr 23, 2026
Several years later, another obligatory check back to see whether this now decade-old, relatively basic and highly-requested feature has been implemented yet. Cygwin is getting old in the tooth and this feature is currently the only thing stopping me from upgrading to Windows 11 because I don't want to have run the several
usbpidcommands above everytime I need to securely wipe a drive or do any other low-level drive operations. If the devs are worried about making this behaviour open to the average Windows user it could be made opt-in via a Bash variable or system setting, while still making things usable for power users who know what they're doing... and WSL2 in its own right tends to be installed by those users anyway. But since so far it seems the devs have no interest in implementing this feature at all, maybe this is an opportunity to move to Linux Mint instead.hashimaziz1 commentedon Apr 23, 2026
ddis an old tool with old defaults, specifically a block size of 512 bytes for compatibility reasons. It needs to be used with at leastbs=4Mto get any reasonable level of speed on modern drives.