Using NFS

What is NFS?

NFS is a distributed file system that provides transparent access to files residing on remote disks. Developed at Sun Microsystems in the early 1980Õs. The NFS protocol has been revised a number of times over this time span. It is available on all Unix systems, including Berkeley 4.4 and Linux, VMS, Mac, IBM, and Novell. Other alternatives to NFS include:

  • AFS — Andrew File System developed at CMU
  • DFS — Distributed File System from OSF.
  • RFS — Remote File System found on older V.3 versions of Unix.
  • Netware — Novell based file system.
  • Problems with NFS.

  • — Not Secure.
  • — Performance is average at best and doesnÕt scale well.
  • — Maintaining a truly distributed file system can be complicated if many machines supply data.
  • — Locking is not good and can cause problems when used simultaneously by multiple applications.
  • Why is NFS used then?

  • — It is ubiquotous.
  • — It is easy to setup and administer.
  • — It provides a better solution than the alternative of not sharing files.
  • more info
    Red Hat distributions (Mandriva, Fedora) look for nfs service, Debian like look for nfs-kernel-server.
    Starting services:# /etc/init.d/portmap start
    # /etc/init.d/nfs-common start
    # /etc/init.d/nfs-kernel-server startor ( service portmap start; service nfs start, using Fedora)

    NFS setup: Edit /etc/exports file.
    Examples:
    /home/files 192.168.0.*(ro)
    /home/work 192.168.0.*(rw)
    /files 192.168.0.3(rw)
    /home/fred 192.168.0.*(rw,async)

    If you use “noacess” parameter, you’ll be sharing only the files in the folder and blocking subfolders access.

    After /etc/exports updates, restart the service:

    # /etc/init.d/nfs-kernel-server restart

    Start or stop the service:

    # /etc/init.d/nfs-kernel-server stop
    # /etc/init.d/nfs-kernel-server start

    (The service in Fedora calls nfs)

    How to mount:

    As root (or using sudo)
    # mkdir /mnt/files
    # mount -t nfs 192.168.0.1:/files /mnt/files

    umount:
    umount /mnt/files

    Discussion Area - Leave a Comment