21.2. Mounting NFS File Systems
Use the
mount
command to mount a shared NFS directory from another machine:
mount shadowman.example.com:/misc/export
/misc/local
Warning
The mount point directory on the local machine (
/misc/local
in the above example) must exist before this command can be executed.
In this command,
shadowman.example.com
is the hostname of the NFS file server, /misc/export
is the directory that shadowman
is exporting, and /misc/local
is the location to mount the file system on the local machine. After the mount
command runs (and if the client has proper permissions from the shadowman.example.com
NFS server) the client user can execute the command ls /misc/local
to display a listing of the files in /misc/export
on shadowman.example.com
.
21.2.1. Mounting NFS File Systems using /etc/fstab
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 /etc/fstab
file.
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.