Linux disk partition, directory tree, file system relationship

  After researching for a long time, from the beginning to the end, I couldn't find a suitable way of getting along between the brain and these concepts from the difference and connection of the three. If you do not understand the basic concepts and theories in place, you will make many detours and make many mistakes in your work. After spending a day today, I finally have a better understanding of the difference and connection between the three. I hereby record and share it for everyone to discuss and exchange.

(1) Disk partition

  The first thing to understand is why the disk is partitioned.

  One is to consider data security, and the other is to consider the performance of system access to disk. If a certain partition of a disk is damaged, data not in this partition will not be affected, so that data of different services can be effectively protected. When the system reads and writes, the disk partition that is too large will reduce the read and write performance of the system, and the partition can speed up the access speed to the data of a certain partition. Just like when we search for files on the C drive, we will search all the disk partitions, but when the partition is too large, the search time will last for a long time.

  So, in general. When there are unpartitioned disk devices in the server configuration, after installing the disk, the first thing to do is to partition the disk.

  After partitioning, the entire disk is divided into several independent disks. The data on these disk partitions are independent. Therefore, different file systems can be created on different partitions without affecting files in other partitions.

(2) File system

  We all know the concept of an operating system, which is a system program that manages computer hardware and software resources, which is low-level. So as the most important resources, data and files on the computer, how should they be organized and managed?

  This requires a file system. A file system is an operating system that organizes and manages data and files.

  File systems are not part of a computer's operating system because no file system is exclusive to any operating system. The object of the file system is only the file, not the computer.

  The file system is a part of the computer operating system, because there is no operating system that does not need files, and the file system is needed to operate if files are needed.

  Based on the different ways of organizing and managing files, there are many file systems to choose from.

  In the actual learning and production environment, there are basic file systems, log-type file systems, database-type file systems, network file systems, and distributed file systems.

  The significance of these file systems is to solve specific problems of data or files in the actual production process, such as the location of file access, file attributes, speed of reading and writing, huge and scattered files, etc., all of which require file systems to organize and management.

  The Linux system can support many types of file systems. In the actual production process, choosing an appropriate file system plays a key role in accessing files that exist on the disk.

  In conclusion, a file system is a way of organizing files or data.

(3) Directory tree

  Different from the win system, the Linux system operates the file through the directory tree, this file structure. The most critical part of the directory tree is the root directory. When accessing files in a directory, it also starts from the root directory. Therefore, if the file can be accessed through the directory tree, the root directory must have a foothold.

  Imagine such a scenario: the directory tree is a file structure that exists in memory. What should I do to access a certain disk through the directory tree? Then you need to mount the disk to the root directory or a directory in the root directory. In this way, you can enter the directory where the disk is mounted through the directory, and access the files in the directory is to access the disk data.

  Therefore, after the system is started, the root directory must be mounted, that is, there must be a disk that can store the root directory. This process is usually mounted automatically.

(4) The relationship between disk partitions, file systems, and directory trees

  It is time to understand the relationship between the three.

  If I have a disk partition with data on the disk, how can I make the Linux system access the data?

  The answer, of course, is to create a Linux-supported filesystem on this disk partition. If a file system in FAT format is created, the disk partition has a file system at this time, and the disk partition can be supported by the win system and read the data in it, but cannot be read by Linux.

  If my disk partition has a file system supported by Linux, how does Linux read it?

  The answer is mounts. Mount means to mount the disk to a directory. So that the Linux system can enter the disk partition.

  If at this time, the disk does not have a file system, or there is a file system that Linux does not support, then Linux cannot read the disk data.

  To sum it up:

  If I want to read the data of a certain disk partition, I have to format it with a file system that my system can support, so that I can recognize the data on it; then I have to attach it to my system, so that I can get in; so how do I get in? It is through the mount point - the directory where the disk partition is mounted, entering that directory, and entering the disk partition, and can also identify and manage data through the file system.

  A disk partition is where data and files are stored, a file system is a form used to organize and manage data and files, and a directory tree is the way and way to access data and files.

  With a place to put data and files, the system may not be able to find the disk; if the disk is found, it may not be able to identify the data; how to access the identified data. It is such a progressive relationship.

  ————————— The dividing line of PL ————————————

Such a simple concept and relationship, I have not understood it for a long time.

In fact, in this process, you need to pay attention to:

1. Why partition

2. Why do you want to format

3. Why do you want to mount

Three steps to solve all problems, of course a mount command and its options tell you all this every second

mount mount point filesystem type options for filesystem type mount device

 

From: http://www.cnblogs.com/liwanliangblog/articles/5153862.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326637896&siteId=291194637