The /etc/exports file contains an entry for each directory that can be exported to NFS clients. This file is read automatically by the exportfs command. If you change this file, you must run the exportfs command before the changes can affect the way the daemon operates.

Only when this file is present during system startup does the rc.nfs script execute the exportfs command and start the nfsd and mountd daemons.

Edit the exports file vi /etc/exports and add:


The ro option mean mounting read-only. The root_squash option for not allowing root write access in this directory. For this change to take effect you will need to run the following command on your terminal:

/usr/sbin/exportfs -a

To export the the directory in read/write mode:

/u01/app/oracle *(rw,no_root_squash)

To export an NFS filesystem (via /etc/exports)

The /etc/exports file controls what filesystems the NFS server exports. Its format is as follows:

directory_to_be_exported       hostname(options)
/misc/export    # allow users from to mount /misc/export with the default read-only permissions
/misc/export  # allow users from to mount /misc/export with read and write privileges
/doNotDelete/ClinicalCafe *(rw,sync)      # allow users from * to mount with read and write privileges

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. If there is a space between the hostname and the options, the options apply to the rest of the world. For example, examine the following lines:

/misc/export (rw)

The first line grants users from read-write access and denies all other users. The second line grants users from read-only access (the default) and allows the rest of the world read-write access.

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

/sbin/service nfs reload

To view the status of the NFS daemon

/sbin/service nfs status

To start the NFS daemon

/sbin/service nfs start

To stop the NFS daemon

/sbin/service nfs stop

To start the nfs service at boot time

/sbin/chkconfig --level 345 nfs on

To mount an NFS filesystem (via /etc/fstab)

nfs_fileserver_hostname_or_ip:/directory_being_exported /local_directory nfs defaults 0 0

After adding this line to /etc/fstab on the client system, type the command mount /local_directory at a shell prompt, and the mount point /local_directory will be mounted

To mount an NFS filesystem:

mount nfs_fileserver_hostname_or_ip:/directory_being_exported /local_directory
mount -t nfs -o nfsvers=3 /home/nfs_local

alternative to NFS

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License