I am setting up a NFS for Linux to Linux sharing after wrong assuming SAMBA would do it. I am following the guide here but have some questions.
- Why create a temp folder?
2 What are exports?
3 What is being exported?
this is the code that I am referring to
chmod 1777 /tmp/nfsdemo/
echo '/tmp/nfsdemo/ *(rw,all_squash,insecure,no_subtree_check,fsid=0)' > /etc/exports
I already have a mounted external hard drive:
What is being exported is part of the server's filesystem. Whatever it is that you want to share.
That example is just to make a sample export. So, what you want is to edit
/etc/exports to have:
- 192.168.1.1/24 to your LAN's address/netmask. This makes it so that only clients on that network can connect the the NFS server. The firewall should also prevent outside connections, but I like to be safe.
async basically says allow the server to tell the client any operation succeeded before it gets written out to disk. It is a slight risk of data corruption if the server crashes in the middle of file transfers, but in my experience it's no more risky than a crash itself and not using it hobbles performance so badly it's not worth using NFS. But if you want absolute data safety, change
Once that's done, you don't need the
exportfs command. Just do:
Once that is done, on the client you want to do this:
mount -t nfs 192.168.1.1:/ /local/mountpoint -o async,soft,nfsvers=4
- 192.168.1.1 - change to the server's address of course
async is different on the client than on the server. On the client it means it delays sending writes on the network until memory constraints require it to. Basically it means to cache writes as long as possible. Good for performance and on a good LAN pretty safe
nfsvers=4 causes the client to use NFS version 4. Don't use v3 - I have found on every OpenWrt device I have ever tried it on that NFS v3 is prone to causing the network stack to hang under load. NFS v4 is slightly less performant than v3, but much more stable.
soft causes the client to fail with an error if it looses connection, as opposed to
hard' which will cause it to basically wait forever if the connection drops. Word of warning, don't ever use hard
if the client will be automounting the remote filesystem with its fstab, or else if the remote isn't available you can lose the ability to boot. TBH, I never recommendhard` in any practical circumstance.
At some point you'll prolly want to add the mount to your client's fstab. Just shout out if you want a hand with that.
What does this mean?
mount.nfs: Stale file handle
I receive that message after I try to mount the directory of the client.
sudo mount -t nfs 10.1.1.4:/ /mnt/sda1 -o async,soft,nfsvers=4
Sounds like there is a stale mount somewhere. Perhaps it was mounted and the client reset. I would suggest restarting the nfs server and trying again.
You have the slash around the wrong way it suppose to be
Found this article explains what the problem is and has a solution that fixed the problem.
Just be careful, if you are getting stale mounts so often you have to clean them out with a cron job, there are other problems.
Ah ok! I also, found this article explains how to mount shares on the different Linux systems correctly.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.