0

What’s the best way to make autofs aware of any changes to its map files (e.g. changes in

auto.home
below) without the need to stop the service on RHEL 6.7?

According to autofs man page

If a map is modified then the change will become effective immediately. If the auto.master map is modified then the autofs script must be rerun to activate the changes.

However, if I change my

auto.home
the changes are not automatically seen by autofs. In addition, if I then run
service autofs reload
the changes are still not seen. The changes become effective only after I run
service autofs restart
. However, this would require all the users to stop working on any NFS-shared folders until the restart of the service completes.

Shouldn’t the changes take effect automatically or at least after I run

service autofs reload
? What am I doing wrong here?

See below for the configuration I use:


I have the following simple configuration on two RedHat Linux 6.7 machines, one is acting as the NFS server and the second as the client.

NFS Server:

cat /etc/exports /home/user1/NFS-test *(rw,sync) /home/user2/NFS-test *(rw,sync) </pre></div><!-- /wp:codemirror-blocks/code-block -->   <!-- wp:paragraph -->NFS Client:<!-- /wp:paragraph -->   <!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre> cat /etc/auto.master
/misc   /etc/auto.misc
/net    -hosts
/-       /etc/auto.home --temeout=300
+auto.master

cat /etc/auto.home /home/user1/NFS-test     -ro,soft,intr    server:/home/user1/NFS-test /home/user2/NFS-test     -ro,soft,intr    server:/home/user2/NFS-test </pre></div><!-- /wp:codemirror-blocks/code-block -->   <!-- wp:paragraph -->This works fine and both users (<!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre>user1</pre></div><!-- /wp:codemirror-blocks/code-block --> and <!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre>user2</pre></div><!-- /wp:codemirror-blocks/code-block -->) are able to see their own <!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre>NFS-test</pre></div><!-- /wp:codemirror-blocks/code-block --> directory under their home folder on the client machine.<!-- /wp:paragraph -->  <!-- wp:paragraph -->Now the second line is removed from <!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre>auto.home</pre></div><!-- /wp:codemirror-blocks/code-block --> such that<!-- /wp:paragraph -->   <!-- wp:codemirror-blocks/code-block {"showPanel":false,"languageLabel":"no","mode":"clike","mime":"text\/x-c++src"} --> 				<div class="wp-block-codemirror-blocks-code-block code-block"><pre> cat /etc/auto.home
/home/user1/NFS-test     -ro,soft,intr    server:/home/user1/NFS-test

Then I run

service autofs reload
in order to update the shares. However, the change in
auto.home
is not seen and
/home/user2/NFS-test
continues to be accessible from the client machine.

If on the other hand I run

service autofs restart
then the mapping is correctly updated
/home/user2/NFS-test
is not visible on the client.

I would like to be able to refresh the NFS shares in response to changes in

auto.home
without needing to stop autofs first in order to avoid asking all the users to logout first. Is this possible with
reload
? Is there another way for doing this?


UPDATE

Since my setup is relatively small (1 server and 3 clients) and with only two folders being exported (one read-only and one read-write), I decided to drop the use of

autofs
and use directly NFS by editing
/etc/fstab
on each client. For such a small setup I hope that there won’t be any noticable difference in performance compared to
autofs
. If someone thinks otherwise, please let me know.

In case someone is interested, here is the setup I went for:

The server exports the following folders:

  • /export
    : where all the software will be located (read-only)
  • /home/shared_homes
    : here each user has a folder which is exported to all clients and which is automatically linked in to its home directory. For example, the user
    bob101
    will have a folder
    /home/shared_homes/bob101
    which will be linked to
    /home/bob101/mySharedWorkspace