Mapping samba/nas on pi automount

Soldato
Joined
6 Sep 2016
Posts
11,001
I'm trying to mount a directory on my Qnap Nas, on the Pi3.

I can see it within file explorer/go/network
Qnap (Samba) Public/Music

How do I get \qnap\public\music to mount to a path on my pi3, automatically every boot?
Is there no "map" like in Windows?

I've tried with
sudo nano /etc/fstab

and entering in various things found on the net, it's just not working
 
What are you running on the Pi? Raspian?


You should be able to map it in /etc/fstab - here is my mapping as an example. You don't need the credentials bit if the share is open to guests.

#mount storage samba share
//192.168.1.3/storage /mnt/storage cifs credentials=/home/user/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

Don't forget to create the /mnt/storage directory as a mount point and install cifs-utils on the Pi.
 
Nobody mentioned Windows. Windows uses samba to share directories and so does your NAS so the configuration on your Pi will be the same in any case.

I have a linux server that shares the directory /storage using samba. This is effectively the same as your NAS sharing your \qnap\public\music directory.

I can mount it on my pi as /mnt/storage using the line in my previous post in /etc/fstab.

You should be able to do the same thing, provided;
1. you have cifs-utils installed on your Pi
2. you have shared the directory on your NAS
3. you specify the correct ip address and share name
4. you provide credentials to be able to access the share, if required
 
right got it working, didn't realise samba can be accessed with the pi the same as you can with windows.

Mounted it, but seemed to disappear and reappear after a reboot. Scanning music in LMS let's see how long it takes.
 
Note that the fstab line given in post #2 should really have a "_netdev," before the "credentials" as the line in question is for a remote network mount. It will probably work, most of the time, without it but really any network share mounted via fstab should have that option to make sure that the system does not try to mount the share prior to the network stack being fully loaded.
 
Note that the fstab line given in post #2 should really have a "_netdev," before the "credentials" as the line in question is for a remote network mount. It will probably work, most of the time, without it but really any network share mounted via fstab should have that option to make sure that the system does not try to mount the share prior to the network stack being fully loaded.

While specifying _netdev won't do any harm (for a network share), it is not necessary in my case as systemd detects which shares require the network to be up before mounting. I have multiple linux clients and one Pi all using the same fstab entry and it works flawlessly, all of the time.
 
Good for you, but I know of quite a few instances here where systemd was not detecting this properly and it was causing issues trying to mount things before the network teams were fully up. It's general best practice to include it on entries for network shares.
 
Back
Top Bottom