NSF version 4 HOW-TO

phoenixcomm
  8 years ago
  5

Ok what in the world of Microsoft and Windows and Linux is NFS and why do I need it... Really I'm very happy with SMB or CIFS,  or Samba (reversed engineered SMB) so why change to NFS??

  1. SMB is a kludge, its what you see is maybe what you get.
  2. and it really is not Open...
  3. and NFS just works, and it's dam fast!!

 

History:

NFS is a distributed file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network much like local storage is accessed. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call (RPC) system. The Network File System is an open standard defined in RFCs, allowing anyone to implement the protocol.  There have been several versions with version 4 the latest.

 

My Network is comprised of several Linux Boxes on a 1 Gigabit Network (Player, Whirlwind, RSS), I also have a slower 100 Megabit Backbone which has my slower stuff (WiFi, network printers, etc.  I also have an additional 100 Megabit Network for NexGen my Simulator.  All of the Boxes are LinuxMint Ver 17r2.

For this HowTo I will only concern ourselves with version 4.

 

How I Did It:

I am currently using Whirlwind as my desktop and file server.  There are a lot of Howto's out there and they all have there part but here is mine so here goes.

 

First I have to get NFS on my server.  You have you choice of using Synaptic or the terminal.. I will use and show you the terminal.

$ sudo apt-get install nfs-kernel-server nfs-common

Then edit your exports file. The follow 4 lines are my "exports", remember they will not be the same as yours.

$ sudo vi /etc/exports

/mnt/MyData/public 192.168.1.1/24(rw,async,no_root_squash,subtree_check)

/mnt/MyMedia/Music 192.168.1.1/24(ro,async,no_root_squash,subtree_check)

/mnt/MyMedia/media  192.168.1.1/24(ro,async,no_root_squash,subtree_check)

/mnt/MyMedia/p2p      192.168.1.1/24(rw,async,no_root_squash,subtree_check)

 

so let explain my magic:

  • /mnt/......  Where my filesystem is mounted
  • 192.168.1.1/24  Who I want to share it with.. in this case I am sharing it with everybody hence the /24
  • ro or rw    Read Only or Read Write
  • async    allows the NFS server to violate the NFS protocol and reply to requests before any changes made by that request have been committed to stable storage (e.g. disc drive).
  • no_root_squash  Very often, it is not desirable that the root user on a client machine is also treated as root when accessing files on the NFS server. To this end, uid 0 is normally mapped to a different id: the so-called anonymous ornobody uid. This mode of operation (called 'root squashing') is the default, and can be turned off with no_root_squash.
  • subtree_check is also used to make sure that files inside directories to which only root has access can only be accessed if the filesystem is exported with no_root_squash even if the file itself allows more general access.

 

Now restart the NFS server

$ sudo service nfs-kernel-server start

 

You can test you service and exports by using this:

$ showmount -e

Export list for Whirlwind:

/mnt/MyData/public 192.168.1.1/24

/mnt/MyMedia/p2p  192.168.1.1/24

/mnt/MyMedia/media 192.168.1.1/24

/mnt/MyMedia/Music 192.168.1.1/24

 

Your Done!!

 

Now the Client.... (RSS)

install just the client.

$ sudo apt-get-install nfs-common

 

you can use showmount -e whirlwind on the client to show the servers exports but if you use name on your machines you must update your /etc/hosts file.... (good idea)

$ sudo /etc/hosts

192.168.1.23  Whirlwind

 

now try a mount command. I used my /mnt/  I added two directories under /mnt/ public and music. so here is what you need..

$ sudo mount -t nfs whirlwind:/mnt/MyData/public /mnt/public

now look in /mnt/public for your shares.. Got them. Good now one last thing.. Let make them mount when the machine starts.. cool

 

$ sudo vi /etc/fstab

whirlwind:

/mnt/MyMedia/Music

/mnt/musicWhirlwind:/mnt/MyData/public

/mnt/public

 

Thanks

Cris H. 

This is a reprint of my blog at element14.com

Comments
phoenixcomm 8 years ago

I have an error or the sin of omission which ever.
The clients fstab should be as follows
mount Whirlwind:/mnt/MyData/public /mnt/public NFS


Hammer459 8 years ago

There is still the problem that if the remote goes down and you, the desktop or anything else tries to access the remote disk you will hang the window or in worst case the detsktop for the duration of the NFS-timeout (usually in the vicinity of 5-15 minutes...)
With Automount you get a disk not available instantly.
The new font is much more readable though


phoenixcomm 8 years ago

Sorry for the different type sizes.. im older and 14px is about as small as I can stand. The editing was done in my blogs editor.. so I fixed what I could.. I hope you can all use it..
Thanks again..


lib2know 8 years ago

nothing to grumble about ... it's great, thank you !!!


Hammer459 8 years ago

Really good except 2 things.
1) Why the mega-large font? Default size for the page is perfect.
2) Add automount to the setup and you do not have issues if a remote disk (or box) goes down.