What is mount in linux

王林
王林Original
2019-12-27 13:40:404641browse

What is mount in linux

Mounting refers to connecting the top-level directory in the device file to a directory under the Linux root directory (preferably an empty directory). Access this directory. Equivalent to accessing device files.

To correct a misunderstanding, not any directory under the root directory can be used as a mount point. Since the mount operation will hide the files in the original directory, the root directory and the original directory of the system Do not use it as a mount point, as it may cause system abnormalities or even crash. It is best to use a newly created empty directory as the mount point.

For example, we want to access the data in a U disk through the command line. The following figure shows the file directory structure of the U disk and the file directory structure in the Linux system.

What is mount in linux

Related free learning video tutorial sharing: linux video tutorial

As you can see from the picture above, currently U disk and Linux The system files belong to two file systems. The U disk file cannot be found using the command line. The two file systems need to be mounted.

Next, we create a new directory /sdb-u in the root directory, and mount the U disk file system to this directory through the mount command. The mounting effect is as shown in the figure below:

What is mount in linux

It can be seen that the U disk file system has become part of the Linux file system directory. At this time, accessing /sdb-u/ is equivalent to accessing the U disk.

The /dev/ directory file in the root directory is responsible for all hardware device files. In fact, when the U disk is inserted into Linux, the system will indeed allocate a directory file (such as sdb1) to the U disk, which is located /dev/ directory (/dev/sdb1), but the U disk data cannot be directly accessed through /dev/sdb1/. Accessing this directory will only provide you with some basic information about the device (such as capacity).

In short, when using any hardware device in the Linux system, the device file must be mounted with the existing directory file.

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of What is mount in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn