nfs-utils-0.3.1-13.7.2.1

Support

The Network File System (NFS) was developed to allow machines to mount a disk partition on a remote machine as if it were on a local hard drive. This allows for fast, seamless sharing of files across a network.

The advantage of NFS today is that it is mature, standard, well understood, and supported robustly across a variety of platforms.

Setting Up an NFS Server

  1. An entry in /etc/exports will typically look like this:

    directory machine1(option11,option12) machine2(option21,option22)

     
    directory the directory that you want to share. It may be an entire volume though it need not be. If you share a directory, then all directories under it within the same file system will be shared as well.
    machine client machines that will have access to the directory. The machines may be listed by their IP address or their DNS address (e.g., machine.company.com or 192.168.0.8). Using IP addresses is more reliable and more secure.
    option
    • ro: The directory is shared read only; the client machine will not be able to write to it. This is the default.
    • rw: The client machine will have read and write access to the directory.
    • no_root_squash: By default, any file request made by user root on the client machine is treated as if it is made by user nobody on the server. (Excatly which UID the request is mapped to depends on the UID of user "nobody" on the server, not the client.) If no_root_squash is selected, then root on the client machine will have the same level of access to the files on the system as root on the server. This can have serious security implications, although it may be necessary if you want to perform any administrative work on the client machine that involves the exported directories. You should not specify this option without a good reason.
    • no_subtree_check: If only part of a volume is exported, a routine called subtree checking verifies that a file that is requested from the client is in the appropriate part of the volume. If the entire volume is exported, disabling this check will speed up transfers.
    • sync: By default, a Version 2 NFS server will tell a client machine that a file write is complete when NFS has finished handing the write over to the filesysytem; however, the file system may not sync it to the disk, even if the client makes a sync() call on the file system. The default behavior may therefore cause file corruption if the server reboots. This option forces the filesystem to sync to disk every time NFS completes a write operation. It slows down write times substantially but may be necessary if you are running NFS Version 2 in a production environment. Version 3 NFS has a commit operation that the client can call that actually will result in a disk sync on the server end.

     

  2. Example (/etc/exports)

    /usr/local  192.168.0.1(ro) 192.168.0.2(ro)
    /home       192.168.0.0/255.255.255.0(rw)
    /share      *.mydomain.bt(rw)

     
    Caution
    Be careful with spaces in the /etc/exports file. If there are no spaces between the hostname and the options in parentheses, the options apply only to the hostname.

     

  3. Each time you change /etc/exports, you must tell the NFS daemons to examine it for new information, or reload the configuration file:

    /etc/init.d/nfs restart

     
  4. To start the nfs service at boot time, use the command

    # ntsysv

     

Mounting NFS Filesystems

Use the mount command to mount an NFS filesystem from another machine:

# mount shadowman:/mnt/export /mnt/local

 
The mount point directory on local machine (/mnt/local in the above example) must exist. 

Mounting NFS Filesystems using /etc/fstab

Mounting NFS Filesystems using /etc/fstab

# device           mountpoint   fs-type options   dump fsckorder
...
server:/usr/local/pub    /pub   nfs     rw        0    0

 
The mount point /pub must exist on your machine. After adding this line to /etc/fstab, you can type the command mount /pub at a shell prompt, and the mount point /pub will be mounted from the server.

Back

Copyright © [- SroNey / JohN -]. All rights reserved

Hosted by www.Geocities.ws

1