Fstab file role

Source: Internet
Author: User


I. The role of/ETC/FSTAB files

After the disk is manually mounted, the mount information must be written to the/etc/fstab file, or it will still need to be mounted again the next time the boot starts.

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. So we just need to write the disk's mount information to this file and we don't have to mount it manually after each boot.


Ii. Restrictions on Mount

Before I explain the effect of this file, I would like to highlight the mounting restrictions.

1, the root directory must be mounted, and must be mounted before the other mount point. Because mount is the directory of all directories, all other wood is derived from the root directory.

2. Mount point must be a directory that already exists.

3, Mount point designation can be arbitrary, but must abide by the necessary system directory architecture principles

4. All mount points can only be mounted once at the same time

5. All partitions can only be hung at once at the same time

6. If you uninstall, you must leave the working directory outside the Mount point (and its subdirectories).

Iii. parameters in the/etc/fstab file

Let's look at the/etc/fstab file, which is the contents of the/etc/fstab file in my Linux environment

[Email protected] ~]# Cat/etc/fstab

#

## /etc/fstab# created by anaconda on tue feb 16 02:46:03  2016## 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=6121ee3b-fe66-4b99-b61c-edbd40f87422 /                         Ext4    defaults        1 1uuid= 40a33812-b123-418e-add6-765d8884e9ca /boot                    ext4    defaults         1 2UUID=6b3ff35f-da8b-405b-a349-6776dadedbf0 swap                     swap    defaults         0 0tmpfs                    /dev/shm                 tmpfs   defaults         0 0devpts                   /dev/pts                 devpts  gid=5,mode=620  0 0sysfs                    /sys                      sysfs   d efaults        0 0proc                     /proc                    proc     defaults        0 0/dev/sda4                /data1                   xfs      defaults        1 2uuid= 528245ee-b4d1-4c9b-b52f-0bccfd2cfc19  /data2   xfs   defaults   1 2UUID=bbc30f84-70aa-4233-aa47-606a0ef01e75  /data3   xfs    defaults  0 0


In the file I have made each column to make it easy to identify, we can see a total of six columns.

First list of Device

Disk device file or the label or UUID of the device

1) View the label and UUID of the partition

Label is the label of the partition, in the initial installation of the system is filled with the mount point is the name of the label. You can find the UUID and label name by looking at the information in the superblock of a partition.

For example we want to see the UUID and label name of this device/dev/sda1

[Email protected] u02]# dumpe2fs-h/dev/sda1

$ dumpe2fs -h /dev/sda1dumpe2fs 1.41.12  (17-may-2010) Filesystem volume name :   <none>last mounted on:           /bootFilesystem UUID:           40a33812-b123-418e-add6-765d8884e9cafilesystem magic number:  0xef53filesystem  revision #:    1  (dynamic) filesystem features:       has_journal ext_attr resize_inode dir_index filetype needs_recovery  Extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isizefilesystem  flags:         signed_directory_hash Default  mount options:    user_xattr aclfilesystem state:          cleanerrors&nbsP;behavior:          continuefilesystem os type:        LinuxInode count:               51200Block count:               204800Reserved block count:      10240free blocks:               158241free inodes:               51162first block:               1block size:                1024fragment size:            1024reserved  gdt blocks:      256blocks per group:          8192fragments per group:      8192inodes per group:          2048Inode blocks per group:    256raid stride:              4flex  block group size:    16Filesystem created:        Tue Feb 16 02:35:32 2016Last mount time:           Mon Mar 14 13:04:48 2016Last write  time:          mon mar 14 13:04:48  2016mount count:               8maximum mount count:      -1last checked:              Tue Feb 16 02:35:32 2016Check interval:            0  (<none>) lifetime writes:           45 MBReserved blocks uid:       0  (user root) reserved blocks gid:      0  (group  root) first inode:               11Inode size:                128journal inode:            8default  directory hash:   half_md4Directory Hash Seed:       9e0568d1-da80-46a8-b116-e07bac57c0c1journal backup:           inode  blocksjournal features:          (None) Journal size:              4096kJournal length:            4096Journal sequence:          0x00000024Journal start:             0

Use the following command Blkid to view the UUID

 blkid  |sort /dev/sda1: uuid= "40a33812-b123-418e-add6-765d8884e9ca"  TYPE= "Ext4"  /dev/sda2: uuid= "6121ee3b-fe66-4b99-b61c-edbd40f87422"  type= "Ext4"  /dev/sda3: uuid= " 6b3ff35f-da8b-405b-a349-6776dadedbf0 " type=" swap " /dev/sda4: uuid=" 71d35b53-1b72-4e84-a88b-47f9c6463ef1 " type=" XFS " /dev/sdb: uuid=" 528245ee-b4d1-4c9b-b52f-0bccfd2cfc19 " type=" XFS " /dev/sdc: uuid=" 650a21b1-1875-41f7-bd79-d4a27ce53640 " type=" XFS " /dev/sdd: uuid=" 959E68D8-215E-43B5-BC4D-E32CE41496BF " type=" XFS " /dev/sde: uuid=" 4898ab43-1270-4f39-8e56-6c44f9070ef6 " type=" XFS " /dev/sdf: uuid=" Bdee9783-5a20-4ece-953e-ae4ad8f2df02 " type=" XFS " /dev/sdg: uuid=" 3d1c823b-6638-4320-b9d6-e73de5762176 " type=" XFS " /dev/sdh: uuid=" 53a5dfc5-c678-4573-b9da-e9fc6cd98a00 " type=" XFS " /dev/sdi: uuid=" 2e831076-31d1-4f07-af1d-7d50968d9e21 " type=" XFS " /dev/sdj: uuid= "60411ed1-4f88-4aed-9d89-25427aa61c92"  type= "XFS"  /dev/sdk: uuid= " 3CB76B32-DEDF-4F59-ACB9-1D2CD2DFA1BC " type=" XFS " /dev/sdl: uuid=" 7e7f2def-a58d-4d7e-8473-df904537e3a7 " type=" XFS " /dev/sdm: uuid=" 773c6298-cfa7-4874-bae3-2428707655e5 " type=" XFS "

2) Use the device name and label and UUID as the different identification

The use of the device name (/DEV/SDA) to mount the partition is fixed dead, once the disk slot order has changed, there will be a problem with the name does not correspond. Because this name is going to change.

However, using a label mount does not worry about slot order issues. But keep an eye on your label name.

As for UUID, each partition will have a UUID as its unique identification number after it is formatted. Use the UUID to mount the words without worrying about the problem of confusion.

The second row mount point: The device's mount points, which directory you want to mount.

Third column filesystem: format of the disk file system, including Ext2, Ext3, ReiserFS, NFS, VFAT, etc.

Fourth column parameters file system parameters

Async/sync set whether to run synchronously, default to Async

Auto/noauto the file system is actively mounted when the MOUNT-A command is currently loaded. Default is Auto

Whether the Rw/ro is mounted in read-only or read-write mode

Exec/noexec restricting the ability to perform operations within this file system

User/nouser whether the user is allowed to mount using the Mount command

Whether Suid/nosuid allows the presence of suid

Usrquota boot file system supports disk quota mode

Grpquota boot file system support for group disk quota mode

Defaults colleagues have settings for default parameters such as Rw,suid,dev,exec,auto,nouser,async

The fifth column: can be the dump backup command function

Dump is a command that is used as a backup. Usually the value of this parameter is 0 or 1

0 means do not dump backup

1 represents a daily dump operation

2 for an indefinite date for the dump operation

Whether the sixth column examines sectors

During the boot process, the system defaults to fsck to verify that our system is complete (clean).

0 Do not test

1 earliest inspection (common root directory will be selected)

2 1 level inspection after completion of inspection


This article from "~" blog, declined reprint!

Fstab file role

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.