TimeLinux1

Wednesday, November 3, 2010

Linux HowTo: NFS Primer

NFS or Network File System was introduced by Sun Microsystems in the 1980s as a mechanism to share files with remote hosts. In those days, when the network technology were primitive (and the Internet unknown), this was a great innovation. Over the years, NFS has matured and has been adopted by virtually all Unix and Linux systems. This discussion is a brief primer of the same topic.

-in nfs, which is a client-server technology, the client server communication happens via rpc (remote procedure call).
-portmap  -    is the rpc service manager. Whenever a service wants to make itself available on the nfs server, it needs to register itself with portmap.
-portmap tells the client, where the service is located on the server.

-current versions of nfs are 2, 3 & 4. version 3 being the most common and widely used.

-nfs can be a kernel builtin or it can be a standalone nfs daemon.
-the default seems to be the standalone nfs daemon.

-the primary nfs config file is /etc/exports. and its format is:
        <dir>    <client(permi)>            [ there could be multiple clients ]

-to export /etc/exports:
          # exportfs  <option>
-eg:    # exportfs            -a=export all, -r=reexport, -o=options like ro, rw, no_root_squash (default is root_squash)etc

-to see current mounts:
        # showmount  -e

-to mount an nfs fs on client side:
        # mount -o     <options>    server:/dir        options like ro, rw, soft, hard, bg etc...

-hard     mount    -    client waits indefinitely
-soft    mount    -    client will timeout eventually

-nfs intr     -    nfs interrupt option     - enables processes to interrupt and move on if nfs is not responding.

-default block size in nfs:
        - version 2,3        -    1 KB
        - version 4           -    4 KB
-the above can be tuned using wsize & rsize params        (write and read).
-eg:    in /etc/exports:
            serverA:/home    /mnt/home    nfsvers=3,rw,bg,rsize=8192,rsize=8192

No comments:

Post a Comment