auto mount

serial number field name explain
Field 1 Device Name/
UUID/Device
Label
The first field of the etc/fstab file specifies the
device to be mounted, which can be a device file in the /dev directory, such as
/dev/sdb1 or /dev/cdrom.
The device to be mounted can also be specified by the device label or so called UUID eg
'LABEL=pa_disk' or 'UUID=3e6be9de-8139-11d1-9106
-a43f08d823a6'. It is more secure and stable
to specify the device to be mounted with the device label or the UUID of the device (will be analyzed in detail later).
Field 2 mount point Specifies the directory where the device is mounted. For swap, the mount point is
none; if the mount directory contains spaces, use "\040" to represent
spaces
Field 3 Mount partition file
system type
Defines the file system on the device. Common file types
are ext2, ext3, ext4 (common file types for Linux devices), or
iso9600 (optical disk file system type), etc.
If this field is defined as swap, this record will Associated with a
file or partition for swap purposes. If this field is defined as
ignored, this line will be ignored. This is useful for showing
partitions that are not currently in use.
Field 4 mount parameters Specifying the file system to mount the device is a specific parameter
option that needs to be used, and multiple parameters are separated by commas.
Field 5 Dump parameter This option is used by the "dump" command to check
whether a file system should be dumped. If not, set this field to 0.
If daily backups are required, this field should be 1. If
irregular backups are required, this field should be 1. This field should be 2.
Field 6 Start
the order of checking partitions
This field is used by the fsck command to determine
the order in which file system checks are performed during system restart. For the root partition "/", this value should
be set to 1, and other file systems can be set to 2.
Filesystems should be checked sequentially, and filesystems on different hard disks
should be checked simultaneously to take advantage of the parallelism of the system. If
the last field has a value of 0 or is not set, the fsck program will skip
checking the file system.

e2label can add a label to a partition, which can then be used to mount/unmount the partition.
This is helpful for systems with many disks, where the order of the disks may change.
Suppose the following situations occur: There are several hot-pluggable hard disks on the host. During the operation of the host,
these hard disks need to be plugged and unplugged frequently, so the order of the hard disks including the device names of the hard disks will often change (for example
, /etc/sdb is under may become /etc/sdd), so how can we ensure that the
device ?
This is to use e2label to set a label name for the partition, and use the label instead
of the .
Command sequence error! There is no text in the specified style in the document. -1
[root @localhost ~]# e2label /dev/sdb1 “log_disk”
[root @localhost ~]# e2label /dev/sdb1
log_disk
Command sequence error! No text in the specified style in the document. -2
#
# /etc/fstab
# Created by anaconda on Thu Nov 15 10:29:31 2012
#
# 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=7791d2ce-c9dd-4780-bffc-4c9d5d1467c5 / ext4
defaults 1 1
UUID=3e45eea0-bf5c-406f-84c0-a38cf9b9d2ba 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
Label=log_disk /Log ext4 defaults 0 2
/dev/sdb5 /Project/pa ext4 defaults 1 2
/dev/sdb6 /Project/pb vfat defaults 1 2
/dev/sdb7 /Backup ext4 defaults 1 2
Of course, there are disadvantages to mounting partitions in this way, because the labels of the two partitions may have the same name, and the
system cannot determine which partition to mount. In fact, the safest method is to use the
UUID of the partition device. The full name of the UUID of the mounted file system
is Universally Unique Identifier, which means that each partition has
a UUID value. To be precise, UUID is a string that identifies the storage devices in your system, and its
purpose is to help users uniquely identify all storage devices in the system, no matter what type they are.
It can identify optical drives, USB storage devices, and hard disk partitions in the system.
Compared with device name and device label, UUID has the following advantages:
 It is a truly unique identifier. UUID provides a unique identification string for storage devices in the system.
Unlike partition labels, there will not be two devices with the same UUID in the system.
 It is always unchanged. The device names of the partitions are not always the same, they depend on the order in which the kernel
loads . If you boot the system with the USB stick plugged in, and then unplug
it can lead to inconsistent device name assignments. But UUID is always the same, no matter what
Order
Usage: e2label partition device name [label name]
is used to set or display the volume label of ext2 or ext3 partition.
Note: The newly set label name. Cannot exceed 16 characters



如何插拔,如何调换设备次序。
我们可以通过 blkid 命令来列出系统中所有存储设备的 UUID:
[root@localhost ~]# blkid
/dev/sda2: UUID="7791d2ce-c9dd-4780-bffc-4c9d5d1467c5" TYPE="ext4"
/dev/sda1: UUID="3e45eea0-bf5c-406f-84c0-a38cf9b9d2ba" TYPE="swap"
/dev/sdb1: LABEL="log_disk" UUID="feda157d-c51a-4f8b-8264-545ecfc06c21"
TYPE="ext4"
/dev/sdb5: UUID="19523fce-666e-4ec9-a53e-21723437eeb1" TYPE="ext4"
/dev/sdb6: UUID="5156-CFF4" TYPE="vfat"
/dev/sdb7: UUID="e2e2044b-34a1-4397-ba30-ad06bd964596" TYPE="ext4"
注意, UUID 依据分区不同,长度和格式都可能会不相同。
#
# /etc/fstab
# Created by anaconda on Thu Nov 15 10:29:31 2012
#
# 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=7791d2ce-c9dd-4780-bffc-4c9d5d1467c5 / ext4
defaults 1 1
UUID=3e45eea0-bf5c-406f-84c0-a38cf9b9d2ba 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
UUID= feda157d-c51a-4f8b-8264-545ecfc06c21 /Log ext4 defaults
0 2
/dev/sdb5 /Project/pa ext4 defaults 1 2
/dev/sdb6 /Project/pb vfat defaults 1 2
/dev/sdb7 /Backup ext4 defaults 1 2

-------------

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325566007&siteId=291194637