3

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)

NFS Client:

$ 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

This works fine and both users (user1 and user2) are able to see their own NFS-test directory under their home folder on the client machine.

Now the second line is removed from auto.home such that

$ 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
3
  • 1
    My best guess that it is not the map persists, this is the mounted filesystem persists. autofs mount filesystems and is not responsible to umount them if configuration has changed. You can unmount it and reload config and see if that will work. Anyway restarting autofs do not demand umounting filesystems (not always, but on modern systems it does not interfere already mounted FS).
    – kab00m
    Commented May 1, 2021 at 15:00
  • And yes, I think using fstab for NFS is generally a bad idea. Once you start server without network problems and you have to remount filesystem. The same about network problems in mounted state, autofs do good with -soft NFS option and proper timeout.
    – kab00m
    Commented May 1, 2021 at 15:02
  • You also may use * homes:/export/home/& to add all possible users at once.
    – kab00m
    Commented May 1, 2021 at 15:04

1 Answer 1

0

You are using direct map. For direct map, you need to restart automount. I would suggest you to use indirect map for what you want to do.

1
  • any idea why I might be having the same issue mentioned above with indirect maps??
    – Rashmica
    Commented Sep 18, 2017 at 5:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .