UUID为系统中的存储设备提供唯一的标识字符串,在 /etc/fstab 文件中会用到 UUID,用于硬盘的挂载。如果你在系统中启动的时候,使用盘符挂载时,可能找不到设备而加载失败,而使用UUID挂载时,则不会有这样的问题。[root@usa178 ~]# cat /etc/fstab ## /etc/fstab# Created by anaconda on MonApr 17 17:18:23 2017## 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=145e78f2-a12c-4221-848e-f6deee8bd4ed / ext4 defaults 1 1UUID=37450e3e-9017-4517-88bc-6a38d8819f03 /boot ext4 defaults 1 2UUID=7f382385-308c-4684-a8d3-651ee16836f7 swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0LABEL=/data2 /data2 ext4 defaults 0 0那么怎么知道相应设备的 UUID 呢? 1、blkid命令查看:[root@LAX ~]# blkid/dev/sda3: UUID="356d4065-9613-490e-a22f-f7c1a7b85d84" TYPE="ext4" /dev/sda1: UUID="cb053b9d-9ef8-48e3-8227-683c62d937f6" TYPE="ext4" /dev/sdb1: LABEL="/data2" UUID="29762eb6-8c19-484d-a46b-424c4050a47b" TYPE="ext4" 另一台服务器:[root@usa178 ~]# sudo blkid/dev/sda3:UUID="145e78f2-a12c-4221-848e-f6deee8bd4ed" TYPE="ext4"/dev/sdb1: LABEL="/data2"UUID="608befbb-c55a-4a48-9a2e-9bc64407a85f" TYPE="ext4"/dev/sda1:UUID="37450e3e-9017-4517-88bc-6a38d8819f03" TYPE="ext4"/dev/sda2:UUID="7f382385-308c-4684-a8d3-651ee16836f7" TYPE="swap" 2、文件方式式查看:ls -l /dev/disk/by-uuid [root@usa178 ~]# ls -l /dev/disk/by-uuidtotal 0lrwxrwxrwx 1 root root 10 Apr 18 14:20 145e78f2-a12c-4221-848e-f6deee8bd4ed -> ../../sda3lrwxrwxrwx 1 root root 10 Apr 18 14:20 37450e3e-9017-4517-88bc-6a38d8819f03 -> ../../sda1lrwxrwxrwx 1 root root 10 Apr 18 14:20 608befbb-c55a-4a48-9a2e-9bc64407a85f -> ../../sdb1lrwxrwxrwx 1 root root 10 Apr 18 14:20 7f382385-308c-4684-a8d3-651ee16836f7 -> ../../sda23、命令查看:tune2fs -l /dev/sda1 (需要一个一个设备查看)[root@LAX ~]# tune2fs -l /dev/sda1tune2fs 1.41.12 (17-May-2010)Filesystem volume name:Last mounted on: /bootFilesystem UUID: cb053b9d-9ef8-48e3-8227-683c62d937f6Filesystem 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 behavior: ContinueFilesystem OS type: LinuxInode count: 76912Block count: 307200Reserved block count: 15360Free blocks: 250470Free inodes: 76873First block: 1Block size: 1024Fragment size: 1024Reserved GDT blocks: 256Blocks per group: 8192Fragments per group: 8192Inodes per group: 2024Inode blocks per group: 253Flex block group size: 16Filesystem created: Mon Apr 17 10:16:56 2017Last mount time: Mon Apr 17 14:45:47 2017Last write time: Mon Apr 17 14:45:47 2017Mount count: 5Maximum mount count: -1Last checked: Mon Apr 17 10:16:56 2017Check interval: 0 ( )Lifetime writes: 50 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: 6bf9c3ca-7632-41b1-ad64-375f0623d35cJournal backup: inode blocks