Mount partition by UUID in linux server
How to check UUID
[root@vm_666 ~]# blkid
/dev/mapper/VlGroup: UUID=”a37054-05bb0bb3d6″ TYPE=”ext4″
/dev/sda1: UUID=”2354-BFD5″ TYPE=”vfat”
/dev/sda2: UUID=”8546a028-60e8370cd0a4″ TYPE=”ext4″
/dev/sda3: UUID=”VSUEe9-JDla-H-YLdP0″ TYPE=”LVM2_member”
/dev/sdb1: UUID=”Jt2K-x3YX-DKPG-1c-mzi” TYPE=”LVM2_member”
/dev/sdc1: UUID=”57568644-dbadc066d75e” TYPE=”ext4″
You can also do the following operation
[root@vm_666 ~] # ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Aug 9 16:01 0010c3-596627 -> ../../dm-3
lrwxrwxrwx 1 root root 10 Aug 9 16:07 18f420-b153b64 -> ../../dm-5
lrwxrwxrwx 1 root root 10 Aug 9 16:01 2354-BF -> ../../sda1
lrwxrwxrwx 1 root root 10 Aug 9 16:01 300a5298a452 -> ../../dm-1
lrwxrwxrwx 1 root root 10 Aug 9 16:01 686-adc066d75e -> ../../sdc1
Mount partition
If there is a need to mount partition “/dev/sdc1” to directory “/data”,
you can mount uuid number of/dev/sdc1/ to directory “/data” rather than
/dev/ sdc1 itself , because partition “/dev/sdc1” may change to other
partition ,such as /dev/sdb1 , after system rebooting.
So the operation may failed if you still mount partition “/dev/sdc1” to
directory “/data” .
Execute “mount /dev/disk/by-uuid/686-adc066d75e /data/”
This article is very useful! I won’t worry about changing of disk name any more.