6. Differences between Autodir and Autofs
Issue arises when you are already using the Autofs package, handling the mounts of (home) directories. Let's look at the differences between the two packages:
The main purpose of autofs is to deal with network mounts on demand instead of mounting all at the same time, which results in preserving system resources. Though there is some support in the autofs package to mount home directories on demand, the requirement is that these home directories must exist already.
On the other hand, Autodir specializes only in local directory creation and mounting them on demand.
Autodir can also create real directories in disk file systems, which do not reside in one single flat base directory. This is how utilities like useradd create by default. In a standard file system setup, all home directories reside in the base /home directory. For file systems like ext2 and ext3 performance will degrade if a large number of home directories exist in one single base directory.
For applications accessing these directories, Autodir presents all directories for them in a single autofs mounted virtual base directory on demand; actual directories are created in subdirectories of some other directory in hierarchical style.
For example, the real home for a user with username user1 will be created as /autohome/u/us/user1 if configured that way, but mounted in /home on demand for applications accessing the home directory in /home/user1.
Permissions for the real base directory, where the actual home directories are kept (/autohome in the above example), are kept in such a way that /autohome can not be accessed by anyone except by root.
This mounting of directories on demand and unmounting when not in use presents an interesting opportunity: the ability to tell whether a directory is in use or not. If a directory is not in use, a program like a backup application can be safely started when a directory is unmounted.
Autodir exploits this capability by starting the command-line mentioned backup whenever a directory becomes unused.
There is one more important issue to be presented if you are an administrator reading this document. Autodir does not call the external programs mount and umount, as is the case with the autofs package; rather, it uses system calls directly. As a side effect, it is faster and more reliable, but the mtab file is not updated. I felt this was not necessary as all mounts and unmounts are local directories.
Another minor difference is that Autodir is completely multi-threaded. Autofs is also expected to be multi-threaded in future versions.