Fstab files are familiar to everyone. During Linux Startup, each partition is mounted through the information in fstab. A typical partition entry is like this:
/Dev/sdb5/mnt/USB vfat utf8, umask = 0 0 0
/Dev/sda4 is the partition to be mounted, and sda4 is a Linux
The name of the partition in sequence when detecting the hard disk. Generally, this name will not change, but if you have multiple hard disks and the hard disk changes in the order on your computer, the same name may indicate different hard disk scores.
If you are starting from a USB device, the insertion sequence with other USB devices will also lead to difficulty in partition identification.
UUID can be used in this case. UUID is the full name of universally unique identifier. That is to say, each partition has a unique UUID value, so that there will be no confusion in partition recognition.
Mount the partition with UUID in fstab. It looks like this:
UUID = 1234-5678/mnt/USB vfat utf8, umask = 0 0 0
Enter the uuid value corresponding to the partition after UUID = to mount the partition correctly.
So, how do we know the uuid of a partition?
There are three methods:
1. view the device file information under/dev/Disk/by-UUID.
# Ls-L/dev/Disk/by-UUID/
------
Lrwxrwxrwx 1 Root 10 10-13 0909-090b->.../sdb5
Lrwxrwxrwx 1 Root 10 10-13 09:13 7c627a81-7a6b-4806-987b-b5a8a0a93645->.../SDA
.....
2. Run the vol_id command.
# Vol_id/dev/sdb5
Id_fs_usage = filesystem
Id_fs_type = vfat
Id_fs_version = FAT32
Id_fs_uuid = 0909-090b
Id_fs_uuid_enc = 0909-090b
Id_fs_label = swap
Id_fs_label_enc = swap
Id_fs_label_safe = swap
3. Use the blkid command
# Blkid/dev/sdb5
/Dev/sdb5: Label = "Swap" UUID = "0909-090b" type = "vfat"
The UUID of the partition can be obtained through these three methods. The UUID varies according to the partition, and the length and format are different.