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

A simple method to merge and remove duplicate MySQL tables

Scenario: The crawled data generates a data table...

Gitlab practical tutorial uses git config for related configuration operations

This article introduces the content related to gi...

Detailed steps for installing rockerChat in docker and setting up a chat room

Comprehensive Documentation github address https:...

How to use vite to build vue3 application

1. Installation Tip: There is currently no offici...

Example of using docker compose to build a consul cluster environment

Basic concepts of consul Server mode and client m...

Solution for Docker Swarm external verification load balancing not taking effect

Problem Description I created three virtual machi...

Tips for viewing History records and adding timestamps in Linux

Tips for viewing History records and adding times...

You Probably Don’t Need to Use Switch Statements in JavaScript

Table of contents No switch, no complex code bloc...

How CSS affects the white screen time during initial loading

Rendering pipeline with external css files In the...

Comparison of two implementation methods of Vue drop-down list

Two implementations of Vue drop-down list The fir...

Detailed steps to deploy SpringBoot projects using Docker in Idea

Preface Project requirements: Install the Docker ...

Basic usage details of Vue componentization

Table of contents 1. What is componentization? 2....

Complete steps for Docker to pull images

1. Docker pull pulls the image When using $ docke...

Some Linux file permission management methods you may not know

Why do we need permission management? 1. Computer...

Detailed steps for quick installation of openshift

The fastest way to experience the latest version ...