TimeLinux1

Friday, September 24, 2010

Linux HowTo: NFS (Network File System)

Network File System or NFS was developed by Sun Microsystems in the early 1980s for their Solaris Operating System. Over the years, it has been adopted into most Linux / Unix OS of the day. The basic idea behind NFS is to be able to locally mount file systems residing on a remote system. In this case the local system acts as a client and the remote system acts as a server. NFS is a stateless and unencrypted protocol, meaning that if the server crashes, the client has no way of knowing it, plus the data transfer is unencrypted so if a cracker were to sniff the traffic, they would be able to 'see' the contents of data packets (this could raise some alarms in the Network Security Administrator in your company. More NFS details below..
===

-in nfs, 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.
-On the server side, the primary nfs config file is /etc/exports; and its format is:
        <dir>    <client(permissions)>            [ 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

-On the client side, to mount an nfs fs from  remote system:
        # mount -o     <options>    server:/dir        options like ro, rw, soft, hard, bg etc...
-to see current mounts:
        # showmount  -e


NFS Configuration settings
-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