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

Navicat connection MySQL error description analysis

Table of contents environment Virtual Machine Ver...

Recommended plugins and usage examples for vue unit testing

Table of contents frame First-class error reporti...

Detailed analysis of MySQL instance crash cases

[Problem description] Our production environment ...

Detailed explanation of basic operation commands for Linux network settings

Table of contents View network configuration View...

Implementation of mysql decimal data type conversion

Recently, I encountered a database with the follo...

How to use custom images in Html to display checkboxes

If you need to use an image to implement the use ...

Vue implements graphic verification code login

This article example shares the specific code of ...

How to make a List in CocosCreator

CocosCreator version: 2.3.4 Cocos does not have a...

MySQL database Load Data multiple uses

Table of contents Multiple uses of MySQL Load Dat...

What to do if you forget your mysql password

Solution to forgetting MySQL password: [root@loca...

How to deploy Solidity smart contracts using ethers.js

If you have developed DApps on Ethereum, you may ...

Tools to convert static websites into RSS

<br /> This article is translated from allwe...