Trinix Quick Tip!
NFS Server Maintenance: Reloading the /etc/exports without restarting the server

Reloading The /etc/exports After Edit Without Restarting Your NFS Server

This Trinix Quick Tip is one of those single line commands that is used rarely and when I need to use it, it seems that I can never remember at least 1 of the following: the name of the command, the syntax used or the available options arguments. Really, if you can at least remember the correct name, you have means of retrieving the information about the command’s syntax and available options by means of the –help command option or man command name to browse the manual page of the command

If your like me however, I’m not the best at remembering names and this trait seems to be getting worse with age. Last night I needed to make a change to my NFS server’s /etc/exports file and wanted to reload the updated settings without having to restart the server.

I knew there was a command to do just that, so I proceeded to search the Inter-webs and came across the answer quickly. It ended up being a stackexchange.com page of course, and the answer also had a brief explanation of the command and command line options.

The command is:

~exportfs -ar

Basically this command reloads the /etc/exports file and updates the exported file systems. The -a & the -r options are explained below in an excerpt that I got from: NFS Server changes in /etc/exports file need Service Restart? – StackExchange.com

  The exportfs command maintains the current table of exports for the NFS 
    server.  The master export table is kept in  a  file  named
    /var/lib/nfs/etab.  This file is read by rpc.mountd when a client sends 
    an NFS MOUNT request.

  Normally  the  master  export  table  is  initialized  with the contents 
    of /etc/exports and files under /etc/exports.d by invoking exportfs -a.  
    However, a system administrator can choose to add or delete exports 
    without modifying  /etc/exports  or  files  under /etc/exports.d by 
    using the exportfs command.

The options that are being utilized -ra:

   -a     Export or unexport all directories.
   -r     Reexport all directories, synchronizing /var/lib/nfs/etab with 
          /etc/exports and files  under  /etc/exports.d.   This  option
          removes  entries  in  /var/lib/nfs/etab which have been deleted 
          from /etc/exports or files under /etc/exports.d, and removes
          any entries from the kernel export table which are no longer
          valid.

Well that should do it for this one. Just a simple tip/reminder/reference that can be utilized in the future when I need to use it again and again forget what the name of the command is. Hopefully I can remember that I wrote this blog post, but if that’s the case I’ve got bigger issues.

Thanks for checking out the post, and feel free to comment, critique or ask any questions you may have in comments section below.
– Brando out

Leave a Reply

Your email address will not be published. Required fields are marked *