In-depth interpretation of /etc/fstab file in Linux system

In-depth interpretation of /etc/fstab file in Linux system

Preface

[root@localhost ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Nov 3 12:03:31 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=64fc4e32-9cc9-4af9-8846-dc13865f770e / ext4 defaults 1 1
UUID=14c3958d-b0a9-41bd-a046-06e148013349 /boot ext4 defaults 1 2
UUID=15399f4c-8788-4348-b066-34179fe887cb swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0

The /etc/fstab file under the Linux system contains the records of the file systems that need to be automatically mounted after booting. When the Linux system starts, it will read this file to automatically mount the file system. We can set the file system to automatically mount at boot time by modifying this file.

Let's interpret the specific meaning of the contents of this file.

The first column: Device: disk device file or the Label or UUID of the device

You can use the dumpe2label command to view the device label and UUID. Or use the simple command blkid command to view the UUId

Note: The device name (/dev/sda) used to mount the partition is fixed. Once the order of the disk slots changes, the name will not match. Because the name will change.

However, if you use label mounting, you don’t have to worry about the slot order. But always pay attention to your Label name. As for UUID, each partition will have a UUID as a unique identification number after being formatted. If you use UUID to mount, you don’t have to worry about confusion.

The second column: Mount point: The mount point of the device, which is the directory you want to mount it to

The third column: filesystem: the format of the disk file system, including ext2, ext3, reiserfs, nfs, vfat, etc.

Fourth column: parameters: file system parameters, generally set to default: defaults

Parameters that can be set under parameters:

  • Async/sync Set whether to run synchronously. The default is async
  • auto/noauto When downloading the mount -a command, whether this file system is automatically mounted. The default is auto
  • rw/ro Whether to mount in read-only or read-write mode
  • exec/noexec restricts whether "execution" operations can be performed in this file system
  • user/nouser Whether to allow users to use the mount command to mount
  • suid/nosuid: whether to allow SUID
  • Usrquota starts the file system to support disk quota mode
  • Grpquota enables the file system to support group disk quota mode
  • Defaults also has settings for default parameters such as rw, suid, dev, exec, auto, nouser, async, etc.

Fifth column: Whether it can be affected by the dump backup command: dump is a command used for backup. Usually the value of this parameter is 0 or 1

  • 0 means no dump backup
  • 1 means to perform a dump backup every day
  • 2 represents irregular dump operations

The sixth column: Whether to check sectors: During the boot process, the system will use fsck to check whether our system is complete (clean) by default.

  • 0 Do not test
  • 1. Earliest test (generally the root directory will be selected for the earliest test)
  • 2 Inspection after completion of level 1 inspection

This is the meaning of all the fields in the /etc/fstab file. If we want to set the file system to automatically mount at boot, we can do so by modifying this file.

It is important to note that after modifying the /etc/fstab file, when we no longer need to mount the file system and unmount it, we must modify the /etc/fstab file in time. Otherwise, when reading /etc/fstab to mount the unmounted file system during boot, an error will occur because the file system cannot be found, resulting in a failure to boot normally.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM.

You may also be interested in:
  • Python remote download file example on Linux server through paramiko
  • Python reads files on Linux server
  • Creating a file system for ARM development board under Linux
  • Linux kernel device driver virtual file system notes
  • Linux kernel device driver proc file system notes
  • Linux shell searches for files and displays line numbers and corresponding intervals
  • Linux awk example of separating a column of a file by commas
  • Linux command line quick tips: How to locate a file
  • Some Linux file permission management methods you may not know
  • View the number of files in each subfolder of a specified folder in Linux

<<:  React hooks introductory tutorial

>>:  MySQL 5.7 decompressed version installation, uninstallation and garbled code problem graphic solution

Recommend

What to do after installing Ubuntu 20.04 (beginner's guide)

Ubuntu 20.04 has been released, bringing many new...

Table related arrangement and Javascript operation table, tr, td

Table property settings that work well: Copy code ...

Database index knowledge points summary

Table of contents First Look Index The concept of...

Vue routing lazy loading details

Table of contents 1. What is lazy loading of rout...

Sample code for separating the front-end and back-end using FastApi+Vue+LayUI

Table of contents Preface Project Design rear end...

Basic knowledge of MySQL database

Table of contents 1. Understanding Databases 1.1 ...

Implementation of CSS child element selection parent element

Usually a CSS selector selects from top to bottom...

A brief introduction to the usage of decimal type in MySQL

The floating-point types supported in MySQL are F...

2 reasons why html-css tag style setting does not work

1 CSS style without semicolon ";" 2 Tags...

Research on Web Page Size

<br />According to statistics, the average s...

The latest virtual machine VMware 14 installation tutorial

First, I will give you the VMware 14 activation c...

Chrome 4.0 supports GreaseMonkey scripts

GreaseMokey (Chinese people call it Grease Monkey...

Vue mobile terminal realizes finger sliding effect

This article example shares the specific code for...