一、Linux磁盘分区UUID的获取方法
1、# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
240 heads, 63 sectors/track, 129201 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x54f054f0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6772 51196288+ 7 HPFS/NTFS
/dev/sda2 6773 129200 925555680 f W95 Ext'd (LBA)
/dev/sda5 6773 33862 204800368+ 7 HPFS/NTFS
/dev/sda6 33863 47408 102400000 7 HPFS/NTFS
/dev/sda7 47408 61476 106354688 7 HPFS/NTFS
/dev/sda8 61476 61503 204800 83 Linux
/dev/sda9 61503 75048 102400000 83 Linux
/dev/sda10 75048 88593 102400000 83 Linux
/dev/sda11 88593 91302 20480000 83 Linux
/dev/sda12 91302 92657 10240000 82 Linux swap / Solaris
2、# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda11 20G 1.6G 17G 9% /
tmpfs 3.9G 260K 3.9G 1% /dev/shm
/dev/sda8 194M 30M 155M 16% /boot
/dev/sda10 97G 188M 92G 1% /opt
/dev/sda9 97G 298M 91G 1% /var
3、# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Nov 23 10:11:32 2011
#
# 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=15d68d9f-e1a9-45dd-8823-37b7ecafce47 / ext4 defaults 1 1
UUID=575c18d8-4776-4ecf-abd6-1209293d0737 /boot ext4 defaults 1 2
UUID=98b4689f-d70e-4903-a8b4-8054e5a968ee /opt ext4 defaults 1 2
UUID=a9558fcf-9e8b-448f-8003-212716694bce /var ext4 defaults 1 2
UUID=49446740-94ac-46fa-a80d-f072932e9a8a 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
4、我这里要格式化/dev/sda10
# umount /opt
# mkfs.ext4 /dev/sda10
# mount -a 这里报错了,uuid不匹配
# blkid /dev/sda10 得到当前的UUID
# vi /etc/fstab 修改其中/opt那栏的uuid
# mount -a 解决
二、Linux UUID的作用及意义
1、它是真正的唯一标志符