I am in a position where I need to access a drive from WSL. Unfortunately, I need to format it with a specific filesystem (ext4) on WSL since windows doesn't support that filesystem. As a result, I need to be able to have a device file to reference when formatting the disk on WSL. While I can mount a drive to a folder using sudo mount -t drvfs e: /mnt/edrive, I cannot seem to find any information about how to create a device file for a drive mounted in Windows. Is there any way that I can create a device file in WSL that references a drive mounted in Windows?
- 11
- 1
- 6
2 Answers
If I understand you correctly, it sounds like you are looking for a new feature that is coming in WSL, but is currently only available in Windows Insider/Preview. Don't let the fact that the command is named --mount confuse the issue (although it certainly is confusing). At least the way I read the doc (I'm not using Preview), this can create a block device in WSL from a raw, unformatted drive connected in Windows.
- 17,574
- 4
- 44
- 81
The simplest way is to attach your device, e.g. a USB-disk which appears as E:, to your Windows system and reboot.
Then restart wsl2 (WindowsTerm->Debian or whatever) and you will now see a new /mnt/e magically created for you :-)
Then use the command sudo mount -t drvfs E: /mnt/e you show above to mount that disk as a normal unix mountpoint.
- 1,822
- 5
- 17
- 19
- 101
- 2
-
1OP is using _ext4_, which Windows does not support. _drvfs_ mounts are not going to work. – Daniel B Sep 15 '22 at 12:35