LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up NAS with NFS (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-nas-with-nfs-4175717885/)

GeordieJedi 10-18-2022 01:08 PM

Setting up NAS with NFS
 
Hi there guys.

I was hoping that you could help me with a project please.

Background / History:
I have a Synology DS413J NAS device.
It was working well for many years, however a while ago It had a hard drive
failure (was in SHR / RAID-5) so I managed to retrieve my data.

I have very recently decided to set this up again from scratch and bought
some new HDD's (again x3, 4TB drives in SHR / RAID-5)

I am trying to set up the mount points, but I'm struggling.

Steps already taken:

1. Set up a static ip (via DHCP reservation) address for my NAS

2. Set up a static ip (via DHCP reservation) address for my client PC

3. (On the NAS)
Added both the NAS and the client PC to the hosts file
Added both the NAS and the client PC to the hosts.allowed file

4. (On the client PC)
Added both the NAS and the client PC to the hosts file
Added both the NAS and the client PC to the hosts.allowed file

5. (On the NAS)
Added both the NAS and the client PC to the exports file

6. (On the client PC)
Added both the NAS and the client PC to the exports file


Questions:

1. How do I create a mount point (on the client PC) to allow it to see / access
the NAS box ?

2. Whic dir, do I create the mount point in ? -
mnt
media
var


3. What other steps do I need to do, in order to get this to work ?


TIA for any help or advice

Useful details:

NAS: Synology DS413J
NAS OS: DSM 6.2.4-25556

PC details:
OS: Ubuntu 20.04 LTS
OS type: 64-bit
DE: KDE 5.18.8
Kernel: 5.14.0-1051-oem
CPU: 4x Intel Core-2 Q8200 (@2.33 Ghz)
GFX: Intel HD
RAM: 8GB

wpeckham 10-18-2022 02:23 PM

#1 you really should have examined the man pages and documentation on NFS and /etc/exports before starting. You have gone as far to making your PC an NFS server as the NAS box!

#2 take a look at https://www.thegeekdiary.com/underst...-exports-file/ and pay attention to what goes on the server and what happens on the client.

Other good resources will be your distribution wiki or documentation pages and sites like
https://web.mit.edu/rhel-doc/5/RHEL-...g-exports.html and
https://www.golinuxcloud.com/nfs-exp...ions-examples/

rclark 10-18-2022 03:31 PM

As above, the export file is on the server only. The client just needs the client software of NFS installed to be able to mount a folder that was defined in the export file on the NAS server. Simple. Only big gotcha is user permissions to information on the server.

michaelk 10-18-2022 06:04 PM

Why are you not using the DSM control panel to setup NFS and NFS shares on the NAS?

https://kb.synology.com/en-us/DSM/he..._nfs?version=7

You can mount the share almost anywhere just a matter of preference, I would use /mnt.

How the client is configured sort of depends on if you are using version 3 or 4. There are lots of guides on the internet. All you need on the client for software is the nfs-common package. On my Synology NAS everything is a sub-directory of the /volume1 directory.

sudo mount -t nfs NAS:/volume1/share_name /mnt/where_ever

GeordieJedi 10-23-2022 08:36 AM

Thanks for the responses so far guys.

@michaelk
I have used Synology's DSM (ver 6.2.4-25556) to set up the NFS shared dirs on the NAS
(I beleive that I'm using NFS (ver 3) as I specifically did not use the check box
for NSF Ver 4/4.1 (as I'm led to beleive that it allows more granualar access
and permissions, at the price of further complexity).

I'm just looking to get this NAS up and running on my internal network for now
I don't have a burning desire to access my media via the internet ATM


07. I have added mount points for the NAS in my fstab file on my client PC (corellia)
(see below):

fstab (on client PC)
Code:

hoth:/volume1/videos /mnt/video_share/video nfs
nouser,atime,auto,rw,dev,exec,suid 0 0
#
hoth:/volume1/photos /mnt/photo_share/photo nfs
nouser,atime,auto,rw,dev,exec,suid 0 0
#
hoth:/volume1/music /mnt/music_share/music nfs
nouser,atime,auto,rw,dev,exec,suid 0 0

These mount points now show up in the GUI (Dolphin) on KDE as networked dirs

When clicking on them, I receive the following error message:
Code:

"Could not enter folder /mnt/photo_share/photo."

So this now appears to be a permissions problem (from the NAS)


08. Interestingly I tried an experiment -

(On the client PC)
I su'd to a root shell, then cd'd into the dir (on the NAS)
and I was able to access the NAS and its dirs via the shell prompt

8.1. (On the NAS - via DSM / in the NAS GUI) I created a test dir (called test_01)
in volume1/videos/

8.2. (On the client PC) I then re-ran the ls command, and the test dir appeard


09. (On the client PC) I have then run the following command:
Code:

showmount -e hoth
Here are the results:
Code:

/volume1/music  corellia.home
/volume1/photos corellia.home
/volume1/videos corellia.home

This looks promising, hoever the .home at the end of the hostname of the PC (corellia)
looks a bit strange to my eyes.


09. (On the NAS) Here are the results of my exports list:

Code:

/volume1/videos
corellia(rw,async,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,
anonuid=1025,anongid=100)

/volume1/photos
corellia(rw,async,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,
anonuid=1025,anongid=100)

/volume1/music 
corellia(rw,async,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,
anonuid=1025,anongid=100)


10. (On the client PC) I ran:
Code:

sudo mount -a
Output:
Code:

mount: 0: mount point does not exist.
mount: 0: mount point does not exist.
mount: 0: mount point does not exist.


michaelk 10-23-2022 09:51 AM

What are the permissions for /mnt/photo_share/photo. I suspect they are owned by root.

GeordieJedi 10-23-2022 11:47 AM

@michaelk

11. The permissions for the dirs are as follows:

11.1. /mnt/photo_share/photo = root
11.2. /mnt/music_share/music = [my username]
11.3. /mnt/video_share/video = root

11.4. Interestingly, for both root and [my username] when I look at the access permissions
I see the following

user: no access
group: no access
others: no access

However, when I created the mount points for these dirs
I did perform a sudo chown -R [my username] : [my username] on each of the 3 dirs.

However I'm going to try and do this again, to see if makes any improvement


12. (On the client) I ran the following command:
Code:

ls -l /mnt

Result was:
Code:

drwxr-xr-x 3  755 [my username] 4096 Oct 23 12:22 music_share
drwxr-xr-x 3 [my username] [my username] 4096 Oct 23 12:22 photo_share
drwxr-xr-x 3  755 [my username] 4096 Oct 23 12:22 video_share


GeordieJedi 10-23-2022 12:44 PM

13. (On the NAS) Running the following command:
Code:

ps aux | grep nfsd

Gived me this result:
Code:

root      6578  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd4]
root      6580  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6581  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6583  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6585  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6587  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6589  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6591  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6595  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6599  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6601  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6604  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6605  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6606  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6607  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6608  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root      6609  0.0  0.0      0    0 ?        S    13:52  0:00 [nfsd]
root    20164  0.0  0.1  4756  952 pts/1    S+  18:40  0:00 grep nfsd

Would that mean the nfs deamon is running correctly on the NAS ?

GeordieJedi 10-23-2022 12:58 PM

14. (On the client PC) Running the following command:
Code:

mount | grep nfs
Result:
Code:

nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
hoth:/volume1/music on /mnt/music_share/music type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.138,mountvers=3,mountport=892,mountproto=udp,local_lock=none,addr=192.168.1.138)

hoth:/volume1/photos on /mnt/photo_share/photo type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.138,mountvers=3,mountport=892,mountproto=udp,local_lock=none,addr=192.168.1.138)

hoth:/volume1/videos on /mnt/video_share/video type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.138,mountvers=3,mountport=892,mountproto=udp,local_lock=none,addr=192.168.1.138)


GeordieJedi 10-30-2022 09:00 AM

Does anyone have any further thoughts on this, and how to get the shared dirs
from the NAS, to be accessible from my client PC ?

TIA

GeordieJedi 10-31-2022 02:05 PM

I've managed to resolve this.

It was a permissions problem (on the NAS)

I had to change the "Squash" settings to: "Map all users to Admin"
This is what allowed my to access the NAS shared folders on the client.

15. Here are the setps I took to fix it:

(On the NAS)
Log into the web interface > Control panel > Shared folder > (Chose the folder you want to
allow access to from a client).
Edit > NFS permissions > Chose host > Edit > Select the option called "Squash" >
Chose - Map all users to Admin > OK > (Wait for this to be saved)


Thank you to all who shared their time and knowleged with me to get this sorted
It's much appreciated !


All times are GMT -5. The time now is 02:11 AM.