Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Mounting SMB/Plex

Sat May 19, 2018 5:55 pm

Hello
I am new to the Raspberry Pi and have managed to set Plex Media Server and VNC (yay!)

I have a USB external harddrive connected to my Tp Link TD-W9980 router which shares the storage as netbios/smb.

On Windows I use \\192.168.0.202\volume(sda1) to access it. I can access via the Raspberry Pi built-in file manager by typing smb://192.168.0.202/volume(sda1), However I would like to mount the location so I can use it within Plex Media Server.

I've searched online and followed loads of guides and just can't do it.

Please help!

Thanks
Mozart321.

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting SMB/Plex

Sun May 20, 2018 4:37 pm

Add something like this to /etc/fstab and reboot:

Code: Select all

//192.168.0.202/volume(sda1)	/mount_point	cifs	_netdev,username=user,password=password,uid=pi,guid=pi	0	0
Change "mount_point", "user", "password", and "pi" as needed for your configuration.

You'll need root privilages to edit /etc/fstab, and back it up first so:

Code: Select all

sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Replace "nano" with the editor of your choice.

I'm told it's possible to use systemd to mount stuff but I've never used that method so can't help with it.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Mon May 21, 2018 6:26 pm

thagrol wrote:
Sun May 20, 2018 4:37 pm
Add something like this to /etc/fstab and reboot:

Code: Select all

//192.168.0.202/volume(sda1)	/mount_point	cifs	_netdev,username=user,password=password,uid=pi,guid=pi	0	0
Change "mount_point", "user", "password", and "pi" as needed for your configuration.

You'll need root privilages to edit /etc/fstab, and back it up first so:

Code: Select all

sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Replace "nano" with the editor of your choice.

I'm told it's possible to use systemd to mount stuff but I've never used that method so can't help with it.
Thank you so much for your reply, I've just tried this and variations because of the ( and ) which I cannot remove unfortunately, I tried

"//192.168.0.202/volume(sda1)" /media/share1 cifs _netdev,guest,uid=pi,guid=pi 0 0

and

//192.168.0.202/volume\(sda1\) /media/share1 cifs _netdev,guest,uid=pi,guid=pi 0 0

I really don't know why it doesn't work :(((

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting SMB/Plex

Mon May 21, 2018 7:40 pm

Mozart321 wrote:
Mon May 21, 2018 6:26 pm
//192.168.0.202/volume\(sda1\) /media/share1 cifs _netdev,guest,uid=pi,guid=pi 0 0

I really don't know why it doesn't work :(((
Probably because you're not specifying a username/password and, I suspect, you misunderstand what the "guest" mount option does.

From "man mount.cifs":
guest
don't prompt for a password
So without specifying a user name or password and using guest, mount will use the default username and password as explained here:
user=arg

specifies the username to connect as. If this is not given, then the environment variable USER is used. This option can also take the form "user%password" or "workgroup/user" or "workgroup/user%password" to allow the password and workgroup to be specified as part of the username.

password=arg
specifies the CIFS password. If this option is not given then the environment variable PASSWD is used. If the password is not specified directly or indirectly via an argument to mount, mount.cifs will prompt for a password, unless the guest option is specified.
Given when the mount is performed these environment variables may not be set so the server won't allow the connection. Or it might explictly deny any login attempts as "root" (automatic mounts in /fstab are performed by root).

Check the log files for errors.

It works from the desktop file manager as that silently passes your username to the server then prompts for a password if required.

Assuming you don't need a password try this in /etc/fstab:

Code: Select all

//192.168.0.202/volume(sda1) /media/share1 cifs _netdev,username=pi,guest,uid=pi,gid=pi 0 0
If you do need a password, include "password=somepassword" in your mount options.

Just to clear up another possible point of confusion, uid and gid apply only to the client (i.e. the machine doing the mount) not the server. That never sees the values given for those options.
(Edit: fixed typos :))
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Mon May 21, 2018 8:25 pm

Hi Thanks again for the really detailed reply.
I don't need a password as you said as I've ticked anonymous access in the router set up.

When I use

//192.168.0.202/volume(sda1) /media/share1 cifs _netdev,username=pi,guest,uid=pi,gid=pi 0 0

and then

sudo mount -a

I get the following:

mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I'm not sure how to find the logs, could you point me in the right direction?
Thanks

Roken
Posts: 225
Joined: Sun Dec 31, 2017 4:35 pm

Re: Mounting SMB/Plex

Mon May 21, 2018 8:33 pm

Try adding "password=" to the mount line.

Also, make sure you are delimiting with tabs and not spaces. e.g.

//192.168.0.202/volume(sda1)<tab>/media/share1<tab>cifs<tab> _netdev,username=pi,guest,uid=pi,gid=pi,password=<tab>0<tab>0

Where all <tab> are the actual tab (i.e. don't copy and paste this)
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Mon May 21, 2018 8:43 pm

Hi Roken
Thank you for the reply, I've replaced all the spaces with tabs and added password (I cut and pasted and replaced <tab> with an actual tab)

The message I get now is:

password specified twice, ignoring second
mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)


Thank you.

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting SMB/Plex

Mon May 21, 2018 8:48 pm

Mozart321 wrote:
Mon May 21, 2018 8:25 pm
Hi Thanks again for the really detailed reply.
I don't need a password as you said as I've ticked anonymous access in the router set up.

When I use

//192.168.0.202/volume(sda1) /media/share1 cifs _netdev,username=pi,guest,uid=pi,gid=pi 0 0

and then

sudo mount -a

I get the following:

mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I'm not sure how to find the logs, could you point me in the right direction?
Thanks
For logs try running

Code: Select all

dmesg
or looking at /var/log/syslog.

This is obvious but, is the NAS up? Has its IP address changed? Can you ping it from the pi or access its web interface?

A quick google for "mount error 112" suggests that it may be a mismatch between the protocol version needed by your NAS and the one mount.cifs is using. Try adding "vers=1.0" to your mount options. Warning: I'm not an expert and have not encountered that error and there may be security implications in this change.

Beyond that I'm probably not the person to ask. Sorry.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting SMB/Plex

Mon May 21, 2018 8:51 pm

@Roken: Tabs or spaces shouldn't matter. Though things could get confused if there are spaces in any of the paths.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Tue May 22, 2018 11:09 am

Thank you, I'm at work but will try again when I get home tonight (adding the vers-1.0)
I will also check the logs.

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Tue May 22, 2018 7:08 pm

Thank you so much Thagrol, adding the vers-1.0 worked perfectly.
I really appreciate the time you have given me.

Thanks again.

Scotty1701A
Posts: 1
Joined: Sat May 19, 2018 11:02 pm

Re: Mounting SMB/Plex

Tue May 22, 2018 7:44 pm

Also works for mounting Apple‘s Timecapsule.
It drove me crazy and I observed the same error messages but finally:

@Mozart321: Big hands to you!! - adding „vers=1.0“ to the mount options did the trick and made all the difference.

Mozart321
Posts: 7
Joined: Sat May 19, 2018 5:51 pm

Re: Mounting SMB/Plex

Wed May 23, 2018 10:18 pm

Sorry one more thing does anybody know how to run
sudo mount -a
autmatically when boooting as every time I restart I have to do it manualy.
Thanks

User avatar
DougieLawson
Posts: 33816
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Mounting SMB/Plex

Wed May 23, 2018 10:33 pm

Add a line in /etc/fstab for the filesystem you need mounted at boot.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting SMB/Plex

Thu May 24, 2018 12:24 pm

Mozart321 wrote:
Wed May 23, 2018 10:18 pm
Sorry one more thing does anybody know how to run
sudo mount -a
autmatically when boooting as every time I restart I have to do it manualy.
Thanks
You shouldn't need to. That gets done automatically during boot.

If you want to run it anyway add it to /etc/rc.local (above "exit 0")
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

Return to “Beginners”

Who is online

Users browsing this forum: Ernst and 33 guests