Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL Ext4 (mount --bare) problem when shared on network #11355

Closed
1 of 2 tasks
marcal opened this issue Mar 23, 2024 · 10 comments
Closed
1 of 2 tasks

WSL Ext4 (mount --bare) problem when shared on network #11355

marcal opened this issue Mar 23, 2024 · 10 comments
Assignees
Labels

Comments

@marcal
Copy link

marcal commented Mar 23, 2024

Windows Version

Microsoft Windows [version 10.0.22631.3296]

WSL Version

2.0.14.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Ubuntu 22.04.4 LTS

Other Software

No response

Repro Steps

  1. wsl --mount \.\PHYSICALDRIVE2 --bare
  2. Create a Ext4 partition on a hard drive (or one that already exist ext4 but I would like zfs or btrfs).
    lsblk says the drive is in sdc1
  3. mkdir /mnt/d/Test
  4. mount /dev/sdc1 /mnt/d/Test
  5. Copy files from wsl to /mnt/d/Test and they are not in windows
  6. Copy files from windows to d:\Test and they are not in wsl

Expected Behavior

A file copied from one OS to the other shoult be there (I took ext4 as it is supplied but it would be for btrfs or ZFS).

Actual Behavior

dir from windows shows nothinf while ls in linux works
(and reverse when a copy is made in Windows)

Diagnostic Logs

No response
EDIT : I know I can use
\wsl.localhost\Ubuntu\mnt\ext4\ (with subst too)
if I mount in the /mnt/ext4 folder
but in that case I can't share the drive on the network for other computers so I would like so put it in a specific map
Can you please help me?

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@marcal marcal changed the title WSL Ext4 (mount --bare) WSL Ext4 (mount --bare) problem when shared on nerwork Mar 23, 2024
@marcal marcal changed the title WSL Ext4 (mount --bare) problem when shared on nerwork WSL Ext4 (mount --bare) problem when shared on network Mar 23, 2024
@OneBlue
Copy link
Collaborator

OneBlue commented Mar 25, 2024

@marcal: This is most likely a mount namespace issue. WSL uses two different mount namespaces depending on whether you're running elevated or not.

/mnt/wsl is shared between both namespaces though, so can you try mounting the disk there and see if that solves the issue ?

@marcal
Copy link
Author

marcal commented Mar 26, 2024

Hello,
I have made the mount again (/mnt/wsl/ext4)
then the mklink to mount the wsl in a share on the host. (d:\Share\ext4)
I can access the ext4 like before from the link but only locally. (so I can go to d:\Share\ext4 and copy files)
From another computer, accessing the share works , but not the link to the wsl (so the ext4). Here is the error I have
(\marc-PC\Share), I see ext4 but I have an error accessing it. The other parts of the share (not wsl) work perfectly.
image

Thanks again for the help

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 26, 2024

@marcal: This is unfortunately by design. \wsl.localhost is per-user, so if you create a link with let's say mklink, that will lose user information depending on which actual user account the filesystem access is made from.

If you want to share the content of a WSL distro of the networking, running a samba server would be your best best.

@OneBlue OneBlue closed this as completed Mar 26, 2024
@OneBlue OneBlue reopened this Mar 26, 2024
@marcal
Copy link
Author

marcal commented Mar 26, 2024

Hello,
Bit if I do that, I won't be able so use SMB3 to put virtual machines on the linux partition? Is it correct? Or is there an other type of symbolic link?
Thank you for the help

@oldshensheep
Copy link

SMB3 operates at the file level, for virtual machines, you require block-level access, which can be achieved using the iSCSI protocol. Currently, I'm utilizing ZFS on WSL2 and tgt iSCSI. I'm waiting for ZFS on Windows to become more mature before switching to it.

@marcal
Copy link
Author

marcal commented Mar 28, 2024

Hello,
Thank you for the information. What I don't like with ISCSI is that I lose the possibility to use the iscsi zvol in the WSL.
And IScsi can be done in a true virtual machine (not wsl) but I will give it a try (only for testing of course)

@oldshensheep
Copy link

You can use iSCSI zvol in the WSL and you can use iSCSI in WSL, just need something like targetcli-fb, for zvol you can compile kernel with ZFS and change the configuration to replace the original kernel.

@marcal
Copy link
Author

marcal commented Mar 28, 2024

Hello,
Thanks for the information.
For my tests with ZFS I used
https://github.com/alexhaydock/zfs-on-wsl?tab=readme-ov-file
but I think the standard kernel doesn't have Microsoft changes so I don't know what I lose with ZFS.
There is no problem with the same zvol with ISCSI used in 2 different OS at the same time (last time I tried 8 years ago with vsphere and truenas and Windows there were conflicts when writing datas)?

@oldshensheep
Copy link

oldshensheep commented Mar 29, 2024

I was aware that, so I change the kernel source to https://github.com/microsoft/WSL2-Linux-Kernel .
https://github.com/oldshensheep/zfs-on-wsl .

ISCSI used in 2 different OS at the same time

Years ago, I tested it to run games, and it worked fine. But for writing the same data, data corruption may occur. Read only is safer, if you want to write, mount iSCSI as read only and using something like overlayfs for writing. Reads go to Server, writes go to client(I think you can add another iSCSI block device… so all go to server).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants