Linux Autofs automatic mount service installation and deployment tutorial

Linux Autofs automatic mount service installation and deployment tutorial

1. Introduction to autofs service

When we use Linux, if we want to access hardware resources, we need to use the mount command to mount the hardware resources and correspond them to a directory before we can access and use the storage medium. If you use samba or NFS services, you also need to mount the remote storage device. Mounting is a necessary step to use external storage media or file systems. However, if too many resources are mounted, it will cause a certain load on network resources and server resources, thereby reducing server performance.
To solve this problem, we can use the autofs service. Autofs is a system daemon. We can write the mount information into its configuration file. If the user does not access other storage media, the system will not mount it. If the user tries to access the storage medium, autofs will automatically mount it. All the above operations are transparent to the user. In this way, the autofs service saves the server's network and hardware resources.

2. Autofs installation and deployment

Autofs can be installed using yum. The installation command is as follows:

yum install -y autofs

The main configuration file of the autofs service is /etc/auto.master. After opening it, you need to write the format in the main configuration file:

Destination mount directory Sub-configuration file of the mount directory

For example, if we want to mount /dev/cdrom to the /mnt directory, we need to write the following content:

insert image description here

The red line part is the newly written content.

Then create the /etc/cdrom.misc file and write the following content:

iso -fstype=iso9600,defaults :/dec/cdrom

Among them, iso represents the sub-mount directory under this directory. After completing all the above operations, start the autofs service. Sometimes the autofs service is configured to start automatically. The autofs startup command is as follows:

systemctl start autofs

The autofs startup command is as follows:

systemctl enable autofs

3. Autofs effect verification

Next, let's verify the effect of the previously configured autofs. The verification idea is as follows: When it is not mounted, try to access the mount directory to see whether the autofs system process mounts automatically. The verification process is as follows:

insert image description here

It can be seen that the system did not mount /dev/cdrom originally, but when we accessed the /meida/iso directory, the system automatically mounted it. Obviously, the autofs service ran successfully!

This is the end of this article about the Linux Autofs automatic mounting service installation and deployment tutorial. For more relevant Linux Autofs automatic mounting service content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux system AutoFs automatic mount service installation and configuration
  • Tutorial on installing AutoFs mount service under Linux

<<:  Div exceeds hidden text and hides the CSS code beyond the div part

>>:  How to use the debouce anti-shake function in Vue

Recommend

VMware ESXi installation and use record (with download)

Table of contents 1. Install ESXi 2. Set up ESXi ...

How to point the target link of a tag to iframe

Copy code The code is as follows: <iframe id=&...

How to modify the user and group of a file in Linux

In Linux, when a file is created, the owner of th...

Detailed explanation of MySql 5.7.17 free installation configuration tutorial

1. Download the mysql-5.7.17-winx64.zip installat...

Several common CSS layouts (summary)

Summary This article will introduce the following...

JS uses canvas technology to imitate echarts bar chart

Canvas is a new tag in HTML5. You can use js to o...

One line of code teaches you how to hide Linux processes

Friends always ask me how to hide Linux processes...

JavaScript removes unnecessary properties of an object

Table of contents Example Method 1: delete Method...

Echarts Basic Introduction: General Configuration of Bar Chart and Line Chart

1Basic steps of echarts Four Steps 1 Find the DOM...

JavaScript to implement random roll call web page

JavaScript writes a random roll call webpage for ...

Nginx configuration 80 port access 8080 and project name address method analysis

Tomcat accesses the project, usually ip + port + ...

IE8 Developer Tools Menu Explanation

<br />This article has briefly explained the...

Detailed explanation of how two Node.js processes communicate

Table of contents Preface Communication between t...

MySQL grouping queries and aggregate functions

Overview I believe we often encounter such scenar...

Undo log in MySQL

Concept introduction: We know that the redo log i...