Linux boot automatically mount the set Detailed

The automatic current power after loading, it is necessary to modify automatically mounts the file system / etc / fstab. But be careful start of this document would affect the system, because the system is dependent on when the document is loaded decided to start the file system.

First, we open the file to see it.
[the root @ localhost ~] # VI / etc / fstab
the UUID = c2ca6f57-b15c-43ea-bca0-f239083d8bd2 / ext4 Defaults. 1. 1
the UUID = 0b23d315-33a7-48a4-bd37-9248e5c44345 / Boot. 1 2 ext4 Defaults
the UUID = 4021be19-2751 Defaults swap swap-383368c39edb -4dd2-98cc 0 0
# only three is a real hard disk partition, the following are virtual file system or swap
tmpfs / dev / SHM
tmpfs Defaults 0 0
devpts / dev / PTS
devpts gid = 5 , MODE = 0 620. 0
sysfe / SYS sysfe Defaults 0 0
proc / proc
proc 0 0 Defaults

This file has six fields, we have to explain the meaning.

The first field: partition device filename or UUID (universally unique identifier hard disk, a hard disk will be appreciated that the ID).

This field CentOS 5.5 system is written label name or file name of the partition device partition, now turned into a hard disk UUID. The benefit of this is when the hard disk to increase in the new partition, or change the order of the partitions, or after a kernel upgrade will still be able to ensure that the partition is properly loaded, without incurring start obstacles.

So, each partition UUID in the end what is it? We talked with a view to dumpe2fs command is the command is as follows:
[root @ localhost ~] # dumpe2fs / dev / sdb5
dumpe2fs 1.41.12 (17-May-2010)
Filesystem Volume name: test_label
Last Mounted ON:
Filesystem UUID : 63f238f0-a715-4821-8ed1-b3d18756a3ef
#UUID
... output omitted ...

May also be determined by looking at each UUID UUID link disk file name, command follows:
[the root @ localhost ~] # LS -l / dev / Disk / by-UUID /
total amount of 0
Irwxrwxrwx the root 10 the root. 1. 4. 00:17 0b23d315-33a7-48a4-bd37-9248e5c44345 month. 11
-> ... / ... / sdal
Irwxrwxrwx the root. 1. 4 the root 10 April 4021 be19-2751 -4dd2-98cc-00:17. 11 383368c39edb.
-> ... / ... / sda2
. Irwxrwxrwx 1 root root 10. 4-dated 63f238f0 a715-4821-8ed1-00:17. 11 b3d18756a3ef
-> ... / ... / sdb5
Irwxrwxrwx the root 10 the root. 1. 4-dated ad9e-6858b440 00:17. 11 45cb-B411 -963c5419e0e8.
- > ... / ... / sdb6
Irwxrwxrwx the root 10 the root. 1. 4-dated c2ca6f57 b15c-00:17. 11-43ea bca0-f239083d8bd2.
-> ... / ... / sda3

The second field: mount point. Again, mount points should be established in an empty directory.

The third field: the file system name, CentOS 6.3 is the default file system should be ext4.

The fourth field: Mount parameters, consistent with the specifications of the mount and the mount command.

The fifth field: Specifies whether the dump partition backup, 0 represents no backup, 1 for backup, 2 for occasional backup.

Sixth field: fsck is detected whether the specified partition, 0 to not detected, other priority numbers represent detected higher priority than 2 to 1. So the first detection zones 1, 2 and then detection zones. Priority 1 is a general partition, other partitions are priority 2.

Able to read this document, right? We / dev / sdb and / dev / sdb6 two partitions added / etc / fstab file, the command is as follows:
[the root @ localhost ~] # VI / etc / fstab
the UUID = c2ca6f57-b15c-43ea-bca0-t239083d8bd2 ext4. 1 Defaults . 1
the UUID = 0b23d315-33a7-48a4 bd37-9248e5c44345 the I-2. 1 Defaults Boot ext4
the UUID = 4021be19-2751-4dd2-98cc the swap the swap-383368c39edb Defaults 0 0
tmpfs / dev / tmpfs Defaults 0 0 SHM
the devpts / dev / PTS GID the devpts . 5 =, MODE = 0 620. 0
the sysfs / SYS Defaults the sysfs 0 0
proc / proc proc Defaults 0 0
/ dev / sdb5 / disk5 ext4 Defaults. 1 2
/ dev / sdb6 / 2. 1 disk6 ext4 Defaults

Write partition UUID, but written directly partition device file name, which is also possible. However, if you do not write UUID, will the idea, after modifying the disk order, / etc / fstab file should be changed accordingly.

Here masterpieces directly using the device file for the file first field partition, of course, you can write UUID partition. But more advanced UUID, device file name slightly simpler.

So far, the partition on the establishment of complete, as long as the next reboot, to test whether the system can start properly on it. As long as / etc / fstab file modification correct, there would not be any problems.

Published 160 original articles · won 97 Like · views 160 000 +

Guess you like

Origin blog.csdn.net/zyy1659949090/article/details/88176786