"Turn"/etc/fstab function detailed
Recently went to the customer site, encountered a question about mount file /etc/fstab file, wrote a /etc/fstab file of the role of each parameter in the meaning of a file. Please correct me if you have any reference to the wrong place.
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
# This file was edited by Fstab-sync-see ' Man Fstab-sync ' for details
# Device Mount point filesystem parameters Dump fsck
label=//ext3 Defaults 1 1
Label=/boot/boot ext3 Defaults 1 2
None/dev/pts devpts gid=5,mode=620 0 0
NONE/DEV/SHM TMPFS Defaults 0 0
NONE/PROC proc Defaults 0 0
None/sys Sysfs Defaults 0 0
Label=swap-sda3 swap swap defaults 0 0
/dev/sdb1/u01 ext3 Defaults 1 2
uuid=18823fc1-2958-49a0-9f1e-e1316bd5c2c5/u02 ext3 Defaults 1 2
/dev/hdc/media/cdrom1 Auto pamconsole,exec,noauto,managed 0 0
/dev/fd0/media/floppy Auto pamconsole,exec,noauto,managed 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 the /DEV/SDA 1 device
[Email protected] u02]# dumpe2fs-h/dev/sda1
DUMPE2FS 1.35 (28-feb-2004)
Filesystem volume Name: /boot// This is the Label name
Last mounted on:
Filesystem uuid:3b10fe13-def4-41b6-baae-9b4ef3b3616c //uuid
Filesystem Magic number:0xef53
Filesystem Revision #: 1 (dynamic)
Filesystem features:has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
Default mount options: (None)
Filesystem State:clean
In a simple way, we can use the following command to view
[Email protected] u02]# blkid/dev/sda1
/dev/sda1:label= "/boot" uuid= "3b10fe13-def4-41b6-baae-9b4ef3b3616c" sec_type= "ext3" type= "ext2"
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.
Second row, Mount Point
The mount point of the device is the directory you want to mount to.
Column three 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 |
whether the file system is actively mounted when the MOUNT-A command is downloaded. Default is auto |
Rw/ro |
whether to mount 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 |
Suid/nosuid |
Whether to allow the existence of SUID |
Usrquota |
Boot file system supports disk quota mode |
Grpquota |
Boot file system support for group disk quota mode |
Defaults |
Colleagues with RW, Suid,dev,exec,auto,nouser,async and other default parameters settings |
The fourth 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 |
Rep don't do dump backup |
1 |
Represents a daily dump operation |
2 |
Perform a dump operation that represents an indefinite date |
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 |
First Test (Common root directory selection) |
2 |
Inspection after completion of the 1 level inspection |
"Turn"/etc/fstab function detailed