Jump to content

How to access NFS share on Linux


Go to solution Solved by robbrown99,

Recommended Posts

Posted

I am new to NFS, but familiar with SMB. I set up an NFS (and SMB) share, and struggling to understand how to access it.

 

The SMB share automatically shows up. The NFS does not... and looking at the interweb, there is a lot of convoluted setup to get it working via command line.

 

Are there any GNOME or other utilities that make setup simpler?

 

I'd like to set this up, have the share be auto-mounted, and be able to access this like any other system folder (most desktop apps give a file picker, and don't allow for manual address entry).

 

I am on Fedora linux.

 

Thanks

Posted

OK, OK

 

I found a helpful video on youtube. I created a folder under my local /mnt/ directory but I can't seem to mount, probably because I am not passing any password?

 

The --help option isn't very helpful about how to add credentials

 

rbrown@localhost-live:~$ sudo mount 192.168.1.109:/Rob /mnt/nfs/Rob
mount.nfs: access denied by server while mounting 192.168.1.109:/Rob

 

 

Posted

I found some documentation on fedora

 

I had my command wrong when passing the folder arguments

 

This command helps find the folder:

rbrown@localhost-live:~$ showmount -e 192.168.1.109
Export list for 192.168.1.109:
/mnt/user/nextcloud *
/mnt/user/Rob       *

 

 

I then mounted the folder.

rbrown@localhost-live:~$ sudo mount 192.168.1.109:/mnt/user/Rob /mnt/nfs/Rob

 

I cannot get it to be read write though. I tried this:

rbrown@localhost-live:~$ sudo mount 192.168.1.109:/mnt/user/Rob /mnt/nfs/Rob -w --read-write

 

I also tried adding *(rw) to the NFS share in UNRAID. That doesn't work either

 

Any ideas on how I can mount as R+W?

Screenshot from 2024-08-27 21-59-56.png

  • Solution
Posted (edited)

Thanks @Frank1940 I just managed to get it working while you were typing this response.

 

It is more convoluted than I'd like, but it works. NFS is significantly faster for small file transfers (which for a photo library is what I need) than SMB. I tried both and NFS very obviously faster. Steps below.

 

STEP 1. In the media server software (in this case Unraid), set up the share to support NFS in both
a) the share itself: SHARES >> <SHARE NAME>add rule *(rw) , Export = Yes, Security = Private
b) under  SETTINGS >> NFS >> Enable NFS = Yes, Tunable (fuse_remember): 330 (default)

 

STEP 2. On linux desktop client,
a) Find the name of the NFS open terminal: type the following, where the IP address is that of your media server.

showmount -e 192.168.1.109


This will then return a list of the NFS shares that have been exported, e.g.
 

Export list for 192.168.1.109:
/mnt/user/nextcloud *
/mnt/user/Rob       *


 

b) Copy the name of the share you want to mount e.g. /mnt/user/Rob

 

STEP 3. Set up the NFS share to automount:
a) Open folder /etc/ , open 'fstab' in a text editor (you may have to use super user privileges to save it)
b) Enter the following into fstab at the bottom of the file taking the share path and IP address from step 2. Note the format is as following:

 

<yourserver IP address>:<path to the exported share you want to mount from step 2b> <path you want to mount the NFS share to e.g. /mnt/name>  nfs <options> 0 0

 

More details on the options to set are here:
[https://linuxopsys.com/linux-nfs-mount-entry-in-fstab-with-example](https://linuxopsys.com/linux-nfs-mount-entry-in-fstab-with-example)

example:
 

192.168.1.109:/mnt/user/Rob /mnt/nfs/Rob  nfs rw,hard,intr,nofail,timeo=14 0 0
mount /mnt/nfs/Rob


 

Then save the file.

c) In terminal run
 

systemctl daemon-reload

 

STEP 4: Reboot the system to ensure this mounts persistently.
Your folder should mount automatically under the path from Step 2b e.g. /mnt/nfs/Rob

 

 

Given this was a struggle, how can I go edit the Unraid user documentation to make this easier for people in the future?

Edited by robbrown99
Posted

Let me say that you are on the right path.  However, you need to do a couple of things first.  Can I assume that you have some knowledge of the Linux command line?  I am going to have you check  a few things first before suggesting that you prepare a Guide to setting up NFS.   These are to make sure that files/directories that you create on your server will also work when they are accessed using SMB.

 

You need to use the Linux    ls   command to see that your client is writing the proper group and permissions for SMB to have access to them.  Below is an example of what I mean:

image.png.254e93d9e7cf336c1a93d1749532eb2f.png

 

Notice that there are three different Owners-- nobody, smbuser, user   (smbuser and user are the user names that I selected for my various Windows client computers.)

Notice that there is only one group-- users

Notice that the permissions for files are:    -rw-rw-rw-          (Often designated as 666)

Notice that the permissions for directories are: drwxrwxrwx       (Often designated as 777)

 

Only the owner has various names.  In my analysis of how Unraid SMB works, all owners must be a member of the users group.  This is done by adding a Share Access user using the Unraid Users tab.   Now look at my screen capture.  I assure you that I can have full read/write access to everything in this directory from any client computer using SMB whether they are logged in as 'user' or 'smbuser'!  You may ask how this can be?  It is my conclusion that it because they are members of the users group!  

 

So check to see that the files/directories you are creating from the NFS client has users as the group and has the permissions of 666 (for files) and 777 (for directories).  (By the way I understand the the default for many Linux distributions is for these to be 664 or 755!) 

 

IF you need more info on how SMB works, see here:

        https://forums.unraid.net/topic/110580-security-is-not-a-dirty-word-unraid-windows-1011-smb-setup/

 

  • Like 1
Posted

Thank you @Frank1940

 

I ran that command, and it looks like the appropriate folders do indeed have the permissions. Thank you for the tip there.

 

I did notice an issue where my NAS wasn't on earlier, then when my client computer started the automount failed (but did not hang!). I need to write a script to manually mount it if it comes online out of sequence. Shouldn't be an issue in the future if NAS is always on but you never know. Right now I turn it off as I'm still building it and the fan is too loud (that's another project).

Screenshot from 2024-08-28 22-12-20.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...