NixOS-WSL icon indicating copy to clipboard operation
NixOS-WSL copied to clipboard

Doesn't automount drive letter mounted shares

Open zyrain opened this issue 1 year ago • 4 comments

Bug description

In windows I have SMB shared mapped to drive letters. On the WSL side, I only have physical drive letters (like C) and special driver ones (like google drive), normal SMB shares don't exist.

To Reproduce

Steps to reproduce the behavior: Create a windows share and map it to a drive letter.

Expected behavior I expect the mapped drive letters to show up under /mnt/ just like the others.

This can be manually fixed with mounting with type drvfs in the filesystems config, but getting the filesystem options (like metadata and uid/gid) correct is error-prone.

zyrain avatar Sep 06 '23 16:09 zyrain

Additionally, when I do add the mount options to the filesystems configuration, it doesn't automount on boot (fails), yet, after boot, a sudo mount -a will mount it correctly.

fileSystems."/mnt/z" = { device = "Z:\"; fsType = "drvfs"; options = [ "metadata" "uid=1000" "gid=100" "noatime" ]; };

zyrain avatar Sep 06 '23 17:09 zyrain

I'm not aware that this works on any WSL distro, so I'd say this is a bug on Microsofts side and not introduced by us. At least I just tested it on Ubuntu and the network drives aren't present there either

I didn't even know that it's possible network drives through WSL at all, to be honest - so thanks for enlightening me

nzbr avatar Sep 09 '23 11:09 nzbr

I have auto-mounting working like this:

fileSystems."/mnt/j" = {
  device = "J:";
  fsType = "drvfs";
};

Perhaps it doesn't like the \?

Or was the issue specifically with the options? Never tried mounting with options.

terlar avatar Nov 14 '23 21:11 terlar

I had guessed that it's because the network drives aren't available yet when NixOS tries to mount then. But the backslash might be a problem as well

nzbr avatar Nov 20 '23 19:11 nzbr