How is autofs used in unix init booting

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the unix category.

Last Updated: 2022-05-26

The goal of autofs is to provide on-demand mounting and (race-free, automatic) unmounting of various other filesystems.

Using autofs here simply means that we can create a mount point without having to provide the backing file system right away. Hence it only delays accesses. This provides a key advantage:

There is no need to delay booting of services until all filesystems are mounted (as was needed in the past, causing slow down). With autofs, processes that try to access a file may be blocked while waiting, but boot sequences in other processes - ones that need need no file system access can continue freely. This is particularly important for when files are on slow network filesystems (e.g. NFS)