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??
- SMB is a kludge, its what you see is maybe what you get.
- and it really is not Open...
- CIFS is single threaded which makes it SLOW!
- 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.
$ 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 or nobody 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 $ 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/MyData/public /mnt/public
whirlwind:/mnt/MyMedia/Music /mnt/music
I think im done...
PS 17JUNE2015 I made a small error! in the client machines you must add NFS to the fstab
>>>>>>>> Whirlwind:/mnt/MyData/Public /mnt/public NFS
PS 21OCT2016 I made a small error! in the line: $ sudo apt-get-install nfs-common
>>>>>>> $ sudo apt-get install nfs-common
BTW if you want to mount your files on a local window 7 box, its not that hard Mount your NFS share on Windows 7
Top Comments