5

I have a folder on Windows C:/Users/macie/dev and I want to mount it on /home/maciek/dev on WSL (Ubuntu) It stops working after restaring Windows. How to make it permanent?

Here's my /etc/fstab file

LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
/mnt/c/Users/macie/dev /home/maciek/dev        none    bind

I used sudo mount --bind -o default too.

mashuptwice
  • 2,929
  • 2
  • 12
  • 25
lincoln06
  • 51
  • 1
  • 3
  • This might be relevant for you: [github issue](https://github.com/Microsoft/WSL/issues/2636) – mashuptwice Jul 23 '22 at 12:38
  • Also, [this question](https://superuser.com/q/1710001/1210833), which for some reason I'm unable to use as a "dupe" target. Apologies - I was about to point you to this one in your Stack Overflow question, but it got migrated (my fault for voting too early) while I was typing the comment. – NotTheDr01ds Jul 23 '22 at 12:39
  • 1
    Does this answer your question? [How do you configure Windows Subsystem for Linux 2 (WSL2) to use fstab to automatically mount a Windows Network File Share?](https://superuser.com/questions/1710001/how-do-you-configure-windows-subsystem-for-linux-2-wsl2-to-use-fstab-to-automa) – mashuptwice Jul 23 '22 at 12:48

1 Answers1

1

While I am not familiar with WSL, I realized that you are missing a few options in your fstab. Also you did not specify a filesystem type. Judging from this github issue, it seems that you need to specify drvfs if you want to mount a directory from your windows installation.

Try the following:

/mnt/c/Users/macie/dev /home/maciek/dev drvfs defaults,bind 0 0

And test with mount -a then restart and check if it worked.

mashuptwice
  • 2,929
  • 2
  • 12
  • 25