0

I have a Windows machine (Windows-10). There I've installed the Ubuntu app from Canonical Group Limited, this allows me to have a Ubuntu subsystem, which I regularly use for grep, sort and other interesting commandline tools.

Now I have created a shared drive on another machine (\\other_machine\Log), which contains some logfiles I'd like to analyse.

I have created two mounting points in order to access the C:-drive and the D:-drive on my PC, this is working fine:

Linux Prompt$ df -hk
Filesystem     1K-blocks      Used Available Use% Mounted on
C:\            999036924 731107332 267929592  74% /mnt/c
D:\            976727036   2621776 974105260   1% /mnt/d

Now I guess that, in order to access the mentioned shared directory, I need to create a mounting point towards that directory.

Does anybody know how I can do that?

Thanks

Edit

I am willing to modify the /etc/mtab file, if that is what is takes:

Linux Prompt>cat /etc/mtab
C:\134 /mnt/c drvfs rw,noatime,uid=1000,gid=1000,case=off 0 0
D:\134 /mnt/d drvfs rw,noatime,uid=1000,gid=1000,case=off 0 0

1 Answer 1

0

Really it's the same as you would on pure Linux - Use Samba/CIFS:

sudo apt install cifs-utils
sudo mkdir /media/othermachine-log
sudo sh -c 'echo "//othermachine/log   /media/othermachine-log  cifs    user,username=<othermachine_username>  0 0" >> /etc/fstab'

mount.cifs //othermachine/log /media/othermachine-log

The first three lines are just setup that need to be done once. The last one you should run whenever you want to mount the Logs for analysis.

You can, of course, manually edit /etc/fstab instead of echoing to it.

This will work under WSL2, at least. I haven't tried yet under WSL1, but I don't know of a reason off the top of my head why it wouldn't work there.

Note that there is no concept of mounting at "startup" under WSL, so the noauto option is a bit unnecessary (but best practice in general when setting up a mount like this). Because of this, you'll typically mount it "on demand" when needed.

If you need to have it always available, then you can do something like:

  • Set up a credentials file for the CIFS share so that you don't have to enter a password when mounting
  • Check in your startup config (e.g. ~/.bashrc) whether the directory is currently mounted and mount it if not

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .