Using exportfs to create temporary exports
It's not always desirable to create permanent exports within the /etc/exports
file. Should you want to define a new export temporarily, you can use the exportfs
command. As we have already defined the NFS root to be /var/exports
, all directories that we export must be after that structure. Let's temporarily export /var/export/doc
to all hosts. We can do so using the following command:
$ sudo exportfs *:/var/exports/doc
On the next restart of nfs-server
, this export will be lost; however, if you need to delete it ahead of this, you can implement the following command:
$ sudo exportfs -u *:/var/exports/doc
Should you need to include export options with the temporary export, use the -o
option in a similar manner, as shown in the following command:
$ sudo exportfs *:/var/exports/doc -o ro,all_squash
To display the current exports, you can run exportfs
by itself:
$ sudo exportfs