I am using Ubuntu with WSL with a zsh/bash shell. My host OS is Windows 10. I already figured out how to mount a Windows external drive:
sudo mkdir /mnt/dsudo mount -t drvfs D: /mnt/d
I rarely plug this drive in, so I'd like to automatically mount it when I do. It's fine if this occurs after I plug the drive in, then start a new WSL terminal.
I don't want to put this command in a .bashrc
type of file because having to type in my password every time I open a terminal would be more trouble than it's worth, especially if 99% of the time, the command will fail anyway. Putting it in a bash script won't help either, because I'd run it so infrequently, by the time I need to use it, I'll forget I created it in the first place.
So, is there a way to mount an external drive when it becomes available in WSL?
I don't know if this is a good solution, but this tells you how to turn off the password request for sudo. This is the route I took: https://superuser.com/a/1492456/89165