https://zhuanlan.zhihu.com/p/625907996
1. The role of /etc/fstab file
After the disk is manually mounted, the mount information must be written into the /etc/fstab file, otherwise it will still need to be remounted at the next boot.
When the system is powered on, it will actively read the contents of the /etc/fstab file, and mount the disk according to the configuration in the file. In this way, we only need to write the mount information of the disk into this file, and we don't need to mount it manually after each boot.
2. Mounting restrictions
Before explaining the role of this file, I want to emphasize the limitations of mounting.
1. The root directory must be mounted, and must be mounted before other mount points. Because mount is the root directory of all directories, other woods are derived from the root directory/.
2. The mount point must be an existing directory.
3. The designation of the mount point can be arbitrary, but must comply with the necessary system directory structure principles
4. All mount points can only be mounted once at the same time
5. All partitions can only be hung once at the same time
6. If uninstalling, the working directory must be exited from the mount point (and its subdirectories).
3. Parameters in the /etc/fstab file
Let's take a look at the /etc/fstab file, which is the content of the /etc/fstab file in my linux environment
In the file, I have made each column easy to identify, we can see that there are six columns in total.
The first column filesystem
The disk device file or the Label or UUID of the device.
Second column Mount point
The mount point of the device is the directory you want to mount to.
The third column type
The format of the disk file system, including ext2, ext3, reiserfs, nfs, vfat, etc.
The fourth column parameters
File system parameters
The fifth column: whether it can be affected by the dump backup command
dump is a command used as a backup. Usually the value of this parameter is 0 or 1
Whether to check the sector in the sixth column
During the boot process, the system will use fsck to check whether our system is complete (clean) by default.