How to mount a substed drive in windows Ubuntu subsystem
Asked Answered
S

2

10

My development environment on Windows includes substed folders, i.e. the folder c:\MyBuild may be substed to a drive letter, say t:

In a Ubuntu subsystem terminal, I can bind the folder to a mount, as this

sudo mount --bind  /mnt/c/MyBuild /mnt/t

This works fine in the current shell, but its not persistent, and if a bash script is invoked externally, this mount is not present, and so the script may fail saying, folder/mnt/t/someFolder don't exist..

I did add the following to /etc/fstab, but its not working as expected

 /mnt/t /mnt/c/MyBuild none defaults,bind 0 0

How can I make this mount persistent in Windows Ubuntu subsystem?

Selfsatisfied answered 2/3, 2018 at 22:36 Comment(4)
why down voted??Selfsatisfied
You have the first two parameters reversed, it should be "/mnt/c/MyBuild /mnt/t", but there are problems with WSL and fstab. It is supposed to respect it after build 17093 but I haven't had much luck. There is also /etc/wsl.conf and various things you could try with sudoers and .bash_profile or .bashrc, but I haven't found a solution. Good luck.Hyperploid
What is the fstab doing that isn't expected?Cigarette
its not persistentSelfsatisfied
P
1

This issue could be a result of something called the Fast Boot for Windows. This setting is on by default on Windows 10. And on shutdown or reboot Windows simply reloads the C:\hiberfile.sys image and then locks its drive partitions for security. (Making changes to your NTFS partition while it is hibernated is risky. Because of this the WSL tool that mounts the partition will not mount it in Read/Write mode, if it sees the hibernation flag.)

I had the same issue, the drive mounted fine sometimes but at other times it refused to mount and that was very confusing and irritating.

To fix this, goto Control Panel > Hardware and Sounds > Power Options > Find a setting for "Turn on fast Startup" and uncheck the option. Restart your computer and you should have access to the disk.

Plaintiff answered 26/8, 2021 at 3:46 Comment(0)
C
0

I created a link to the path location on c

sudo ln -s /mnt/c/MyBuild /mnt/t

It's not as dynamic as auto mounting a subst'ed folder but keeps the "mount" persistent.

Cherie answered 29/4, 2019 at 6:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.