bonkeman
Posts: 5
Joined: Sun Apr 09, 2017 6:12 pm

Mounting a windows share in Raspbian

Sun Apr 09, 2017 6:56 pm

Hello everybody,

Newcomer on the forum here, with a beginner type of question. I'm a Linux Mint user who knows his way around a computer but with that I mean Windows mostly. So there´s my Linux skills for you :)

I used this guide when I was setting upp my Plex Media Server on my Linux Mint machine (media files is on a Windows NAS):
http://ubuntuhandbook.org/index.php/201 ... ntu-14-04/

It worked back then and I have never bothered with it since. Now I pretty much wanna do the same thing on my new BFF, the Raspberry Pi 3 running Raspbian. I love this little thing, using both Retropie and RasPlex (<--- THIS is awesome), but I do believe I need to learn some more Linux!

The guide is almost working. It's just the last thing, actually mounting with "sudo mount -a". It works but...
1. In Mint I got a shortcut on the desktop and in the file browser. Don't get that in Raspbian.
2. I have to run the "sudo mount -a" all over again if I reboot. It's not remembered.

OK, so number 1 I can live with. Not a big deal. But number 2 is more of a problem. I have tried to put the "sudo mount -a" into

Code: Select all

/home/pi/.config/lxsession/LXDE/autostart
but that doesn't work for me.

Surely there is an easy way. Can someone help me with this one? Is there a better way to do this whole thing?

zebik
Posts: 25
Joined: Sat Feb 13, 2016 11:13 am

Re: Mounting a windows share in Raspbian

Mon Apr 10, 2017 10:15 am

Hi,

You need to edit / add your drive to /etc/fstab in order to be mount at every boot. Find more info here http://elinux.org/RPi_Adding_USB_Drives

profro
Posts: 45
Joined: Tue Nov 15, 2016 1:26 pm

Re: Mounting a windows share in Raspbian

Mon Apr 10, 2017 2:26 pm

I had the same question and here is what I ended up using.

Edit the /etc/fstab to add the following line

Code: Select all

//xxx.xxx.xxx.xxx/filepath/ cifs username=user,password=pwd,noexec,nperm 0 0

bonkeman
Posts: 5
Joined: Sun Apr 09, 2017 6:12 pm

Re: Mounting a windows share in Raspbian

Mon Apr 10, 2017 5:44 pm

Ok, this is not working. I have read up on the syntax of the fstab file but with no further luck. I have tried the example by profro as well.

This is what I have in my fstab file now:

Code: Select all

//192.168.1.10/SharedFolder	/media/NAS	cifs	credentials=/etc/samba/credentials,uid=1000,gid=1000	0	0
It all works fine but I still have to manually type in "sudo mount -a" in the terminal for Raspbian to mount what's in the fstab.

Now I have put a file "xxxxxxxx.desktop" in the folder /home/pi/.config/autostart, with the content:

Code: Select all

sleep=10
sudo mount -a
The sleep=10 just to make sure the fstab has been read first. But with no luck. But when I type it manually in the terminal it works. This is getting frustrating...

Any pointers?

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Mounting a windows share in Raspbian

Mon Apr 10, 2017 5:55 pm

This is what I have in fstab to mount a samba share on another raspberry:

Code: Select all

//raspi1/hdd1   /mnt/raspi1     cifs    user=pi,password='',x-systemd.automount  0 0
The road to insanity is paved with static ip addresses

bonkeman
Posts: 5
Joined: Sun Apr 09, 2017 6:12 pm

Re: Mounting a windows share in Raspbian

Wed Apr 12, 2017 7:27 pm

Ernst wrote:This is what I have in fstab to mount a samba share on another raspberry:

Code: Select all

//raspi1/hdd1   /mnt/raspi1     cifs    user=pi,password='',x-systemd.automount  0 0

Ah, thanks man. That worked. I added the "x-systemd.automount" to my string so that it looks like this now:

Code: Select all

//192.168.1.10/SharedFolder   /media/NAS   cifs   credentials=/etc/samba/credentials,uid=1000,gid=1000,x-systemd.automount   0   0
Case closed!

Return to “Beginners”