WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Block devices, (i.e. /dev/sda) ?

Open ScarFez opened this issue 10 years ago • 125 comments

Is there any ETA on when we can see block devices such as sda, for tools like hdparm ?

Thanks

ScarFez avatar Jul 25 '16 16:07 ScarFez

Thanks for the feedback. @russalex or @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.

sunilmut avatar Jul 28 '16 20:07 sunilmut

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 @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.

russalex avatar Jul 28 '16 20:07 russalex

@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

fpqc avatar Jul 31 '16 15:07 fpqc

@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.

russalex avatar Aug 01 '16 16:08 russalex

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 :(

jtherin avatar Aug 12 '16 13:08 jtherin

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.

finkelamein avatar Aug 12 '16 21:08 finkelamein

@finkelamein idk about that, I think the LVM driver is baked into the Linux Kernel.

fpqc avatar Aug 12 '16 21:08 fpqc

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.

finkelamein avatar Aug 12 '16 22:08 finkelamein

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)

jdevora avatar Aug 23 '16 10:08 jdevora

@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.

fpqc avatar Aug 23 '16 10:08 fpqc

At least fuse will be great. With fuse we will be able to implement\emulate somehow everything other linux specific filesystems.

ghost avatar Aug 29 '16 21:08 ghost

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 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.

ytrezq avatar Sep 25 '16 13:09 ytrezq

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.

georgir avatar Nov 25 '16 10:11 georgir

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

jtherin avatar Nov 25 '16 11:11 jtherin

@georgir That's my general understanding. LXSS does not have a kernel and integrating linux kernel modules with the Windows security-model would be really difficult.

sundhaug92 avatar Nov 25 '16 11:11 sundhaug92

If folks here would like FUSE support (I would), you can up-vote its UserVoice:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13522845-add-fuse-filesystem-in-userspace-support-in-wsl

aseering avatar Nov 25 '16 15:11 aseering

One use would be to mount micropython devices so that you can copy .py files from the local filesystem to the on-board memory without having to have another linux machine lying around.

eeevans avatar Apr 10 '17 18:04 eeevans

Pretty cool use case eevans - I haven't thought of anything like that.

FUSE in userspace is also great in general.

ghost avatar Jul 05 '17 23:07 ghost

@eeevans Can't you do that using the new support for removable drives?

sundhaug92 avatar Jul 07 '17 10:07 sundhaug92

@sundhaug92 probably not. That is specifically in the case of fat32 and ntfs removable media.

fpqc avatar Jul 08 '17 01:07 fpqc