command exports all the file systems in the /etc/exports file to a list
named xtab under the /var/lib/nfs directory, which is used as a guide
for mounting when a remote computer asks for a directory to be exported:
Click here to view code image
matthew@seymour:~$ sudo exportfs -a
The -r option, which stands for re-export, tells the command to reread the
entire /etc/exports file and (re)mount all the entries. You can also use
the exportfs command to export specific files temporarily. Here’s an
example using exportfs to export a file system:
Click here to view code image
matthew@seymour:~$ /usr/sbin/exportfs -o async yourhost:/usr/tmp
This command exports /usr/tmp to yourhost with the async option.
Be sure to restart the NFS server after making any changes to
/etc/exports. If you prefer, you can use Ubuntu’s shares-admin
graphical client to set up NFS from the GUI. Search for “personal file
sharing” in the Dash to start. Fill in the required information, and off you go.
You still need to install some packages on Ubuntu for this to work (the same
ones mentioned earlier in this chapter, in the “Installing and Starting or
Stopping NFS” section and in the next section, “NFS Client Configuration”).
NFS Client Configuration
To configure your host as an NFS client (to acquire remote files or
directories), you need to ensure that you have the nfs-common package
installed to be able to access NFS shares. After you’ve installed this, edit the
/etc/fstab file as you would to mount any local file system. However,
instead of using a device name to be mounted (such as /dev/sda1), enter
the remote hostname and the desired file system to be imported. For example,
an entry might look like this:
Click here to view code image
Device Mount Point Type Options Freq Pass
yourhost:/home/share /export/share none nfs 0 0
NOTE
If you use autofs on your system, you need to use proper autofs
entries for your remote NFS mounts. See the Section 5 man page for
autofs by entering man 5 autofs at the command line.