An alternate way to mount an NFS share from another machine is to add a line to the
/etc/fstab file. The line must state the hostname of the NFS server, the directory on the server being exported, and the directory on the local machine where the NFS share is to be mounted. You must be root to modify the
The general syntax for the line in
/etc/fstab is as follows:
server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr
The mount point
/pub must exist on the client machine before this command can be executed. After adding this line to
/etc/fstab on the client system, type the command
mount /pub at a shell prompt, and the mount point
/pub is mounted from the server.
/etc/fstab file is referenced by the
netfs service at boot time, so lines referencing NFS shares have the same effect as manually typing the
mount command during the boot process.
/etc/fstab line to mount an NFS export looks like the following example:
with the hostname, IP address, or fully qualified domain name of the server exporting the file system.
with the path to the exported directory.
with the local file system on which the exported directory is mounted. This mount point must exist before
/etc/fstab is read or the mount fails.
nfs for NFSv2 or NFSv3 servers, or
nfs4 for NFSv4 servers.