Configure start mounting: fstab file details, and fstab file mounting details

Source: Internet
Author: User

Configure start mounting: fstab file details, and fstab file mounting details
Fstab file Introduction

The fstab file contains information about the storage devices on your computer and their file systems. It determines how a hard disk (partition) is used or integrated into the entire system file. Specifically, fstab can be used to automatically mount hard disks, partitions, removable devices, and remote devices in various file system formats. For Windows and Linux operating systems, you can use fstab to mount partitions in the FAT format and NTFS format to share resources in Linux.

The full path of this file is/etc/fstab. It is just a text file. You can open it in your favorite editor, but it must be a root user to edit it. At the same time, fsck, mount, umount and other commands all use this program.

/Etc/fstab is the configuration file at startup. However, the actual filesystem mounting is recorded in the/etc/mtab and/proc/mounts files. Every time we change the filesystem mount, these two files will also be updated at the same time!

System Mount restrictions:
  • The root directory/must be mounted and must be mounted before other mount points.
  • Other mount points must be created directories and can be specified arbitrarily, but must comply with the required system directory Architecture Principles
  • All mount points can be mounted only once within the same time.
  • All partitions can be attached only once within the same time.
  • In case of dismounting, you must first move the working directory to the mount point (and its subdirectories.
Description of fields in the file

Example:

# <fs>            <mountpoint>    <type>        <opts>        <dump/pass># NOTE: If your BOOT partition is ReiserFS, add the notail option to opts./dev/sda10        /boot            ext4        noauto,noatime    1 2/dev/sda6         /                ext4        noatime           0 1/dev/sda9         none             swap        sw                0 0/dev/cdrom        /mnt/cdrom       auto        noauto,ro         0 0

In fact,/etc/fstab (filesystem table) is to write all the options and parameters to this file when we use the mount command for mounting. In addition,/etc/fstab also supports the dump BACKUP command! It depends on whether to perform file system check fsck and other commands at startup.

  • <File systems> mount a device: it is not a file system that we generally understand, but a device (hard disk and its partition, DVD drive, and so on ). It tells us the name of the device (partition), which is used when you mount or detach a device in the command line.
  • <Mountpoint> mount point: tells us where the device is mounted.
  • <Type> file system type: Linux supports many file systems. To obtain a complete support list, find mount man-page. Typical names include: ext2, ext3, reiserfs, xfs, jfs, iso9660, vfat, ntfs, swap, and auto. 'auto' is not a file system, instead, let the mount command automatically determine the file type, especially for removable devices, floppy disks, and DVD drives. This is necessary because the file types on each mount may be different.
  • <Opts> file system parameters: these are the most useful settings !!! It automatically loads the mounted device when it is started, prevents garbled characters in Chinese, and limits the read and write permissions on the Mount partition. It is related to the usage of the mount command. For a complete list, refer to mount manpage.
  • <Dump> Backup command: dump utility is used to determine whether to back up the file system. dump checks the entry and uses numbers to determine whether to back up the file system. The allowed numbers are 0 and 1. If it is 0, dump will ignore this file system. If it is 1, dump will make a backup. Most users do not install dump, so for them, <dump> This entry should be written as 0.
  • <Pass> whether to use fsck to check the sector: During the startup process, the system uses fsck to check whether our filesystem is complete (clean) by default ). However, some filesystems do not need to be tested, such as memory swap space (swap) or special file systems such as/proc and/sys. Fsck checks the numbers under this leader to determine the order of the file system. The allowed numbers are 0, 1, and 2. 0 indicates that the test is not performed. 1 indicates that the test is performed first (generally only the root directory is configured as 1), and 2 indicates that the test is performed. However, 1 indicates that the test is performed earlier! In general, set the root directory to 1, and set all other filesystems to 2.
<Opts> common parameters:
  • noatimeDisabling the atime feature to improve performance is a very old feature. You can safely disable it and reduce loadcycle.
  • defaultsUse the default settings. It is equal to rw, suid, dev, exec, auto, nouser, and async. For more information, see the following description.
  • Automatic and manual mounting:
    autoAutomatic mounting when starting or entering mount-a in the terminal
    noautoDevices (partitions) can only be manually mounted
  • Read and Write Permissions:
    roAttach to read-only permission
    rwMount as read/write permission
  • Executable:
    execIs a default setting, which enables executable binary files in that partition to be executed
    noexecBinary files cannot be executed. Do not use this option in your root partition !!!
  • I/O synchronization:
    syncAll I/O will be synchronized
    asyncAll I/O will be performed in non-synchronous Mode
  • User Mount permission:
    userAllows any user to mount a device. Implies noexec, nosuid, nodev unless overridden.
    nouserOnly root users can be mounted. This is the default setting.
  • Temporary File Execution permission:
    suidPermit the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
    nosuidBlocks the operation of suid, and sgid bits.
Restart the system

Restart the system, or entermount -aYou can see the modified results.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.