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
/homewill render original home directories inaccessible.
Configuring AutoFS
ETC Auto Configuration Files:
Two main configuration files are needed:
ETC/auto.masterETC/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 dataThis indicates AutoFS should manage the
/datadirectory as specified inETC/auto.nfs data.
ETC/auto.nfs:Specify subdirectories and details for mounting.
Example content:
files -rw nfs server:/nfs/dataDefines that directory
/data/fileswill 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 AutoFSsystemctl 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/cdromwill mount.Important line:
Accessing /misc/linuxleads to an NFS mount onftp.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/datamanaged by the specified fileETC/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/datashould be visible.
Command:
Use
ls -ato 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
mountcommand to see thatetc/auto.nfs dataservice 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.