Configuring AutoMount

Overview of AutoFS

  • AutoFS is an automated file system that allows for on-demand mounting of file systems.

Introduction to AutoFS Configuration

  • Initial Conditions:

    • When setting up AutoFS for a directory, pre-existing content in that directory becomes inaccessible.

    • Example: Setting up home directories with LDAP and mounting them on /home will render original home directories inaccessible.

Configuring AutoFS

  • ETC Auto Configuration Files:

    • Two main configuration files are needed:

      • ETC/auto.master

      • ETC/auto.nfs

    • ETC/auto.master:

      • Identify the directory that AutoFS should manage.

      • Use a new directory that is not currently employed for any other purpose.

      • Example content:

        • slash data ETC/auto.nfs data

        • This indicates AutoFS should manage the /data directory as specified in ETC/auto.nfs data.

    • ETC/auto.nfs:

      • Specify subdirectories and details for mounting.

      • Example content:

        • files -rw nfs server:/nfs/data

        • Defines that directory /data/files will be created, and AutoFS will mount this when accessed.

AutoFS Activation Process

  • Required Steps:

    • Ensure that the AutoFS service is installed and started.

    • Commands:

      • DNF install -y AutoFS

      • systemctl enable AutoFS

Exam Preparation Tips

  • An important configuration file to review is ETC/auto.misc.

    • It contains example line showcasing syntax usage which is helpful for exam preparation.

    • Example line:

      • For CDs:

      • If accessing /misc/cd, the device /dev/cdrom will mount.

      • Important line:

      • Accessing /misc/linux leads to an NFS mount on ftp.example.org:/pub/linux.

      • Note: This may seem misleading since it contains "FTP" in the name, but it signifies it as an NFS share.

Practical Application Steps

  • Add to auto.master:

    • Example addition to ETC/auto.master:

      • /nfs/data managed by the specified file ETC/auto.nfs.

  • Add to auto.nfs:

    • Example addition in ETC/auto.nfs:

      • files -rw nfs server:/nfs/data.

  • Restart AutoFS Service:

    • Command: systemctl restart AutoFS.

Accessing Mounted Directories

  • Check root directory after configuring:

    • Newly added directory /nfs/data should be visible.

  • Command:

    • Use ls -a to show all entries, confirming visibility.

  • Change directory to files:

    • Command: cd files, and it should function properly because AutoFS will manage this.

  • Mount Verification:

    • Use mount command to see that etc/auto.nfs data service is managing the mounting task, enhancing convenience in accessing target directories.

Conclusion

  • AutoFS facilitates automatic mounting of file systems when they are accessed, significantly improving file organization and access efficiency in Unix-like operating systems.