Mounting a share via Raspi to a QNAS Share

Discussion about using NAS on Linux and Unix OS.
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

I hope someone can help as I am getting more confused as I look at this.

I have done some reading and I through I had the right command but each time, I try to mount a Qnas share via RaspPI I am getting errors, and I don't know were I am going.

I have a Test account on my NAS called TorPi with R/W access to the Media Folder.
I have created a folder called tank within my PI Home folder as a mounting point.

and here are my commands I have tried

192.168.0.7:/Media/TV_shows /home/pi/tank nfs defaults,user,auto,nostime,intr 0 0
//192.168.0.7:/Media/TV_shows /home/pi/tank cifs rw,user,username=TorPi,password=TorPi,uid=1000,gid=1000,iocharset=utf8 0 0
//192.168.0.7:/Media/TV_shows /home/pi/tank nfs default 0 0

and all are reporting the mounting errors from Error(22) or mount.nfs: remote share not in host:dir format.

any ideals ?
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

ok, after a cup off coffee and a bit more reading, I found out my issue, it was me, I was trying to map to a Sub folder on my Qnaps box, which is not allow.
so now I have a working bit of code that looks like this

Code: Select all

//192.168.0.7/Media/ /home/pi/tank cifs username=admin,password=admin default 0 2
the only problem I have now is that when I place this within the "etc/fstab" file, the code is no running when I do a reboot and if I do a

Code: Select all

sudo mount -a 
but I get a error on the map drive line 11. which I can't find any error with at the moment,

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

LABEL=ExtStorage       /ExtStorage     ext4    defaults   0    1

//192.168.0.7/Media/ /home/pi/tank cifs username=admin,password=admin default 0   2
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

chrischambers wrote:

Code: Select all

//192.168.0.7/Media/ /home/pi/tank cifs username=admin,password=admin default 0   2
That syntax doesn't look right.

Can you try this?

Code: Select all

192.168.0.7:/Media /home/pi/tank cifs username=admin,password=admin

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

Hi OneCD. I tried your suggestion, but it didn't work.

I waited for about 5 mins, to give the raspberry time to finish doing it thing, and then tried

Code: Select all

sudo mount -a
and I got the following error message
mount.cifs: bad UNC (192.168.0.7:/media/
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

I think I might know why it Is not working, but I don't know how to resolve it. it looks like that the command is trying to run, was the raspberry is still booting up, and that the wireless services are not running.

is there a way to delay the command for a few seconds to give the raspberry time to finish off loading, before it try's to run the fstab ?
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

chrischambers wrote:is there a way to delay the command for a few seconds to give the raspberry time to finish off loading, before it try's to run the fstab ?
I don't know of a way to do that in fstab as it's just a config file.

You might look at creating a script with the mount command in it and adding init.d & rcS.d entries to call it during startup. When used this way, your mount syntax will be different.

The exact method required will depend on what distro you're running on the Pi. Are you using something like Raspian? :geek:

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

Hi OneCD

Yes I am using the following:
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
how would I go about creating this script and I am not sure what you mean but
adding init.d & rcS.d
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

chrischambers wrote:how would I go about creating this script and I am not sure what you mean but
adding init.d & rcS.d
Have a read of this tutorial. It should get you started & it's easier than what I suggested. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »


ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

thanks for the links, and I have tried the following, but for some reason I can't get the .sh to run automatically, but it works fine, if I run it manual.
here is the code / procedure

Sudo nano startup.sh
Cut and pastle

Code: Select all

if ! ( ping -c 1 192.168.0.1 ) > /dev/null
then
   echo "network is NOT up so wait"
   sleep 2
else
   echo "Network is UP"
   sudo mount -a
   break
fi
Save the file and exit with Ctrl+X, Y then Return
Sudo chmod +x startup.sh

sudo nano /etc/rc.local
Add line /home/pi/startup.sh

Code: Select all

#!/bin/sh -e

# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/startup.sh
exit 0
Save the file and exit with Ctrl+X, Y then Return.

and when I reboot, nothing happens. but if I run the startup.sh manual then I get a error at line 9 - which is the command break

any ideals on how to get the script to work ? as all the reading I have done is point to using the rc.local, but for some reason, I can't get this to work
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

chrischambers wrote: Sudo nano startup.sh
Cut and pastle

Code: Select all

if ! ( ping -c 1 192.168.0.1 ) > /dev/null
then
   echo "network is NOT up so wait"
   sleep 2
else
   echo "Network is UP"
   sudo mount -a
   break
fi
This looks like the solution that was (badly) shown here.

It should look like this:

Code: Select all

#!/bin/bash

while true; do
	if ! ( ping -c 1 My_ROUTER_IP ) > /dev/null then
		echo "network is NOT up so wait"
		sleep 2
	else
		echo "Network is UP"
		sudo mount -a
		break
	fi
done
chrischambers wrote:and when I reboot, nothing happens. but if I run the startup.sh manual then I get a error at line 9 - which is the command break
It failed when encountering the 'break' command as it wasn't inside a loop.

When testing a startup script, always test it manually first. Resolve any errors and re-test. When it runs without error (and works the way it is supposed to), then integrate it into your startup process. :geek:

If you are displaying a script (or command) that was written by someone else, please provide a link to the original. It makes it easier to work out where things are going wrong. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

thanks for the reply and I am sorry that I didn't post the Ref Webpage, but I would like to report that the script works with no issues when I run it manual, but still doesn't work when I reboot the machine.
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

To better assist, I decided to get Raspbian running on one of my Pi's here. I've confirmed that it's possible to mount NAS shares on the Pi via cable or WiFi at bootup and that this can be done without additional scripts.


Raspberry Pi 3 model B running Raspbian Jessie Lite #2016-11-25

--> connected via Ethernet cable (or WiFi) to -->

QNAP TS-569 Pro running QTS 4.2.2 #20161214


on the QNAP
  1. I created a new user in QTS called 'piuser' with a password of 'piuser',
  2. I had to "Enable file service for Microsoft Networking". Personally, I only use NFS, but did this to match what your first post shows,
  3. In "Shared Folders", I assigned RW permission for 'piuser' to my 'Public' share,
  4. Also ensured that "Microsoft Networking host access" was set to allow all hosts (*) for this share.
on the Raspberry Pi
  1. Logged in at the console with 'pi' and 'raspberry'.
  2. Created a mount-point:

    Code: Select all

    $ sudo mkdir -p /mnt/nas/Public
  3. Edited fstab to specify NAS share and mount-point:

    Code: Select all

    $ sudo nano /etc/fstab
    and added this line:

    Code: Select all

    //10.0.0.2/Public /mnt/nas/Public cifs username=piuser,password=piuser,_netdev,x-systemd.automount
    added automount option as per lightswitch05's answer. ;)

    Saved fstab and exited.
  4. Then performed semi-auto mount:

    Code: Select all

    $ sudo mount -a
  5. Confirmed mount occurred:

    Code: Select all

    $ ls -la /mnt/nas/Public
    
    Looks good!
  6. Rebooted Pi, logged in, checked mount-point - success!

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
chrischambers
Know my way around
Posts: 102
Joined: Tue Jun 03, 2014 8:10 pm
Location: UK

Re: Mounting a share via Raspi to a QNAS Share

Post by chrischambers »

Hi OneCD.

I don't know why it has started to work, but for some reason, it has started to mount my share folder.
I re-checked my settings and confirmed that all was the same as your posting above, but I was not able to find the "Microsoft Networking host access" so I Tick the Enable Advanced Folder Permissions to see if that option was within there.

and was the system was applying the new settings, the Raspberry was able to mount.

many thanks for your help.
Regards

Chris
-------------
QNAps = TS - 469 Pro
Firmware = 4.3.4.1463 Build 2020/10/06
RAID 5= 11TB | Disk1 = ST4000VN000-1H4168 | Disk2 = ST4000VN000-1H4168 |
Disk3 = ST4000VN000-1H4168 |Disk4 = ST4000VN000-1H4168

Other Storage = Unraid; Resources = Plex ; Grafana
User avatar
OneCD
Guru
Posts: 12144
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Mounting a share via Raspi to a QNAS Share

Post by OneCD »

chrischambers wrote:I re-checked my settings and confirmed that all was the same as your posting above, but I was not able to find the "Microsoft Networking host access" so I Tick the Enable Advanced Folder Permissions to see if that option was within there.
That's OK. It's a 'Shared Folders' permission setting for each share. But if you're connected now, then it's set correctly.
chrischambers wrote:and was the system was applying the new settings, the Raspberry was able to mount.
Nice work. :geek:

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Post Reply

Return to “Linux & Unix (NFS)”